Commit graph

476 commits

Author SHA1 Message Date
peter klausler
2ccba3837d [flang] Do not emit PROCEDURE(TYPE(REAL)), pgf90 cannot deal. Use PROCEDURE(REAL).
Original-commit: flang-compiler/f18@ee5f392381
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:08 -07:00
peter klausler
24eb863fda [flang] Quick additional fix for crashes on statement functions without arguments
Original-commit: flang-compiler/f18@79779967a9
Reviewed-on: https://github.com/flang-compiler/f18/pull/548
2019-07-03 13:04:56 -07:00
peter klausler
c180c0229f [flang] Trim duplicate error messages on intrinsics, and fix FINDLOC for Character data.
Original-commit: flang-compiler/f18@48ab22e213
Reviewed-on: https://github.com/flang-compiler/f18/pull/548
Tree-same-pre-rewrite: false
2019-07-03 12:30:28 -07:00
peter klausler
dbb202c5be [flang] Extirpate NCHARACTER type, NC"" literals, and EUC-JP Hollerith
Original-commit: flang-compiler/f18@10a592a591
Reviewed-on: https://github.com/flang-compiler/f18/pull/535
Tree-same-pre-rewrite: false
2019-06-28 11:22:43 -07:00
peter klausler
4470eddabd [flang] Work around GCC 7.2.0 build issue
Original-commit: flang-compiler/f18@c68349f78f
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:21:00 -07:00
peter klausler
98e3113206 [flang] Better initialization support
Original-commit: flang-compiler/f18@ff2f26fe7b
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:46 -07:00
peter klausler
56a1941f7f [flang] More extension names
Original-commit: flang-compiler/f18@f30d4cf73d
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:43 -07:00
Peter Waller
c9944df916 [flang] Revert "Remove needless braces"
This reverts commit edd18355be574122aaa9abf58c15d8c50fb085a1.

Original-commit: flang-compiler/f18@e5d164fd11
Reviewed-on: https://github.com/flang-compiler/f18/pull/532
2019-06-26 09:44:08 +00:00
Jinxin (Brian) Yang
125f295353 [flang] OpenMP structural check framework (PARALLEL as example) (flang-compiler/f18#493)
This patch is to show the framework to do OpenMP structure related check and you may find missing/incomplete implementation, which will be added in the future.

1. Each encountering construct has its own context and the context info will be filled while walking the directive/clause nodes. In the `Leave`, the current OpenMP context will be popped out.

2. When entering the construct, necessary nesting check will be performed. Use std::vector to implement the context stack because certain nesting restrictions may need to trace back more than one level.

3. PARALLEL construct is used as an example for clause validity check.

4. `EnumSet` is used to represent the directive/clause sets and to show the error msg. All the error msgs are quoted from the specification.

5. Necessary `CharBlock` is added for error msgs.

Original-commit: flang-compiler/f18@620441c03e
Reviewed-on: https://github.com/flang-compiler/f18/pull/493
2019-06-25 16:18:51 -07:00
peter klausler
9a9b450011 [flang] EQUIVALENCE numeric/character as extension with warning
Original-commit: flang-compiler/f18@0182efb759
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
Tree-same-pre-rewrite: false
2019-06-19 16:34:50 -07:00
peter klausler
4f2c8fae65 [flang] Fix source provenance of .NOT., add ALLOCATED intrinsic
Original-commit: flang-compiler/f18@e7e0de9e0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/505
Tree-same-pre-rewrite: false
2019-06-19 11:50:07 -07:00
peter klausler
7d24cebc17 [flang] Rearrange some move(get<>()) calls into get<>(move()) to dodge GCC possibly-uninit warnings (bogus)
Original-commit: flang-compiler/f18@f369c6025c
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
Tree-same-pre-rewrite: false
2019-06-18 15:15:22 -07:00
peter klausler
f753cf3eb0 [flang] Review comments and last (?) bugs
Original-commit: flang-compiler/f18@db8302e3ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
2019-06-18 13:46:54 -07:00
peter klausler
fdcdd504b3 [flang] more fixes from tests
Original-commit: flang-compiler/f18@bb8df72635
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-18 12:34:23 -07:00
peter klausler
94a667bb94 [flang] nag debugged
Original-commit: flang-compiler/f18@ab91b7c191
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:10 -07:00
peter klausler
fd54622481 [flang] fixes
Original-commit: flang-compiler/f18@f504e6a938
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:10 -07:00
peter klausler
7c4b790c5e [flang] All fixed except for a few NAG differences
Original-commit: flang-compiler/f18@8dea4fb760
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:09 -07:00
peter klausler
8971f7f2b3 [flang] More debugging vs. regression tests
Original-commit: flang-compiler/f18@d4fd4ad1ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:08 -07:00
peter klausler
6911444f76 [flang] Fixes
Original-commit: flang-compiler/f18@73edc5bf2b
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:08 -07:00
peter klausler
15af2b2f06 [flang] Character set and encoding changes
Original-commit: flang-compiler/f18@a550cbd4c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:07 -07:00
peter klausler
e7a21f763a [flang] Tests pass
Original-commit: flang-compiler/f18@ae9d07a2ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:07 -07:00
Jinxin Yang
1e33dfb431 [flang] Add missing IS_DEVICE_PTR and LINK clauses for OpenMP parsing
Original-commit: flang-compiler/f18@541d4031e0
Reviewed-on: https://github.com/flang-compiler/f18/pull/501
2019-06-13 15:33:15 -07:00
peter klausler
fa205d1424 [flang] Improve clarity per review comment
Original-commit: flang-compiler/f18@7206c08f2a
Reviewed-on: https://github.com/flang-compiler/f18/pull/492
2019-06-11 12:50:27 -07:00
peter klausler
a306d92675 [flang] Fix bug flang-compiler/f18#491 (and replace a misleading name)
Original-commit: flang-compiler/f18@d0d154e312
Reviewed-on: https://github.com/flang-compiler/f18/pull/492
Tree-same-pre-rewrite: false
2019-06-11 12:06:18 -07:00
Peter Steinfeld
0bef67225a [flang] Added the machinery for REAL DO controls to be treated as a separate
extension.

Original-commit: flang-compiler/f18@1907cf8672
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
Peter Steinfeld
a698d3d579 [flang] Changes responding to comments on my previous pull request. Specifically --
parse-tree.cc
 - Cleaned up the use of "const" in several declarations.
check-do-stmt.cc
 - Replaced uses of parser::Messages with SemanticsContext.
 - Removed unused "==" operator from the DoStmtContext class.
 - Reduced the size of the GetBounds function by calling GetLoopControl().
 - Changed the warning message for REAL DO controls to not mention standard
   extensions.
check-do-stmt.h
 - Restored the forward reference to Fortran::parser::DoConstruct and removed
   the include of parse-tree.h
dosemantics*.f90
 - Removed extraneous references to the "RUN" command.
test_errors.sh
 - Simplified and generalized the extraction of the OPTIONS specification.

Original-commit: flang-compiler/f18@04a0712766
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
Peter Steinfeld
93a59505a5 [flang] These changes are for issue 458, to perform semantic checks on DO variable
and initial, final, and step expressions.  As a new extension, we want to allow
REAL and DOUBLE PRECISION values for them by default.

Here's a summary of the changes:
 - There already existed infrastructure for semantic checking of DO loops that
   was partially specific to DO CONCURRENT loops.  Because I re-used some of
   this infrastructure, I renamed some files and classes from "concurrent" to
   "stmt".
 - I added some functions to distinguish among the different kinds of DO
   statements.
 - I added the functions to check-do-stmt.cc to produce the necessary warnins
   and errors.  Note that there are no tests for the warnings since the
   necessary testing infrastructure does not yet exist.
 - I changed test-errors.sh so that additional compilation options can be
   specified in the test source.
 - I added two new tests to test for the various kinds of values that can be
   used for the DO variables and control expressions.  The two tests are
   identical except for the use of different compilation options.
   dosemantics03.f90 specifies the options "-Mstandard -Werror" to produce
   error messages for the use of REAL and DOUBLE PRECISION DO variables and
   controls.  dosemantics04.f90 uses the default options and only produces
   error messages for contructs that are erroneous by default.

Original-commit: flang-compiler/f18@f484660c75
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
peter klausler
812bda43f1 [flang] Dodge valgrind complaint by cleaning up the grammar a bit
Original-commit: flang-compiler/f18@3f9f9af1e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
2019-06-07 16:01:21 -07:00
peter klausler
82f119414c [flang] some clean-up
Original-commit: flang-compiler/f18@6134e1c2f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
2019-06-07 16:01:20 -07:00
peter klausler
7269dc8a82 [flang] Remove needless braces
Original-commit: flang-compiler/f18@edd18355be
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
2019-06-07 16:01:20 -07:00
peter klausler
b408a02c14 [flang] Avoid segfault in association semantics by cleaning up code a bit
Original-commit: flang-compiler/f18@04d40c3d75
Reviewed-on: https://github.com/flang-compiler/f18/pull/488
Tree-same-pre-rewrite: false
2019-06-07 10:24:33 -07:00
Jean Perier
6a1b208a4d [flang] Answer first comments
Original-commit: flang-compiler/f18@4058efcd9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:53:57 -07:00
Jean Perier
bc30bef24b [flang] Fix UTF-8 bugs and add related tests
Original-commit: flang-compiler/f18@9dd19ede9e
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:53:23 -07:00
peter klausler
f586ad5e56 [flang] Unparse the typedExpr from semantics, when present, rather than original parse tree expressions
Original-commit: flang-compiler/f18@4274cc8eaa
Reviewed-on: https://github.com/flang-compiler/f18/pull/479
2019-06-04 16:25:06 -07:00
peter klausler
3e313d43e1 [flang] Fix correction of misparsed struct const as actual arg, and semantics of MODULE PROCEDURE in INTERFACE
Original-commit: flang-compiler/f18@6c86de6cef
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:16 -07:00
peter klausler
0ddea8ae24 [flang] Rearrange references to AllSources singleton, fix FindScope for module files
Original-commit: flang-compiler/f18@50ccc1c819
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:09 -07:00
peter klausler
d3b23e9dd6 [flang] Handle large integer literals without kinds better
Original-commit: flang-compiler/f18@381ea32d57
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-30 13:31:11 -07:00
peter klausler
eff41b8fa7 [flang] Complete folding of intermixed array and component references
Original-commit: flang-compiler/f18@70db03e4ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-29 13:22:35 -07:00
peter klausler
59342b0641 [flang] work in progress
checkpoint: changes build, tests all pass

many fixes, ready to test more

Further CLASS(*) support

More fixes for CLASS(*)

Hide data members of DynamicType

implement PRESENT() intrinsic

Original-commit: flang-compiler/f18@044ba12c20
Reviewed-on: https://github.com/flang-compiler/f18/pull/466
Tree-same-pre-rewrite: false
2019-05-20 13:37:28 -07:00
peter klausler
9a13ea959c [flang] Fix bug with comment clipping on compiler directives
Original-commit: flang-compiler/f18@3f4375c57c
Reviewed-on: https://github.com/flang-compiler/f18/pull/463
2019-05-15 12:35:36 -07:00
peter klausler
01a3e1b80e [flang] Strip comments from source and directive lines after macro replacement
Original-commit: flang-compiler/f18@ecf22e6698
Reviewed-on: https://github.com/flang-compiler/f18/pull/460
2019-05-10 16:04:10 -07:00
Tim Keith
4c4f4d2807 [flang] Address review comments
Use better names for template parameters of `LoopBounds`, and also
for the constructor arguments.

Use two overloadings of `loopBounds()` instead of `std::is_same_v<>`.

Original-commit: flang-compiler/f18@a2c0c75462
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
Tree-same-pre-rewrite: false
2019-05-09 10:00:13 -07:00
Tim Keith
351dc98948 [flang] Change parse tree to allow DO loop over REAL
It is a common extension to allow DO loops with REAL variable and
bounds. The parse tree currently parses those with the variable
as `scalar-int-variable-name` and the bounds as `scalar-int-expr`.
That causes the INTEGER constraint to be enforced automatically.

Change the grammar and parse tree to treat them as `scalar-variable-name`
and `scalar-expr`. This allows the name and expression to be REAL,
but we will have to verify that they aren't any other type (in a future
change).

To accomplish this, add a template parameter to `LoopBounds` for the type
of the variable name (always `Scalar<Name>` or `Scalar<Integer<Name>>`).
We sometimes need names for the instantiations of `LoopBounds` so add
type aliases like `LoopControl::Bounds` for each one.

Original-commit: flang-compiler/f18@d75aa03970
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
Tree-same-pre-rewrite: false
2019-05-09 08:33:28 -07:00
Jinxin Yang
d25c942594 [flang] OpenMP 4.5 grammar related minor fixes
1. typo and trailing spaces within OpenMP-4.5-grammar.txt

2. parse (openmp-grammar.h) and unparse(unparse.cc) for:

   SCHEDULE ([modifier [, modifier]:]kind[, chunk_size])
   Modifier ->  MONITONIC | NONMONOTONIC | SIMD

where ":" is optional except at least one modifier is present.

Original-commit: flang-compiler/f18@5cebae5039
Reviewed-on: https://github.com/flang-compiler/f18/pull/453
2019-05-08 14:12:28 -07:00
peter klausler
802895b7c6 [flang] Allow use of (x?"a":"b") as a message argument
Original-commit: flang-compiler/f18@c0d4e55455
Reviewed-on: https://github.com/flang-compiler/f18/pull/451
2019-05-08 11:11:11 -07:00
peter klausler
4ffb37e593 [flang] Remove support for Names in messages for now.
Original-commit: flang-compiler/f18@15d38c7059
Reviewed-on: https://github.com/flang-compiler/f18/pull/444
2019-05-07 10:04:21 -07:00
peter klausler
f704d38129 [flang] Merge with recent changes
Original-commit: flang-compiler/f18@56a72cbbd6
Reviewed-on: https://github.com/flang-compiler/f18/pull/444
Tree-same-pre-rewrite: false
2019-05-07 09:24:35 -07:00
peter klausler
ec6cf76536 [flang] Replace formatting of CharBlock & string
Preserve generated strings until consumed by formatting.

bugfix from premature push

Address review comments

Last fix(?)

Use %s formatting for CharBlocks and strings

Use new formatting and fix usage of std::forward<>()

Use forward_list rather than vector to save strings

Original-commit: flang-compiler/f18@8ea478420f
Reviewed-on: https://github.com/flang-compiler/f18/pull/444
Tree-same-pre-rewrite: false
2019-05-07 09:24:32 -07:00
Jean Perier
c67710e5ae [flang] Allocate semantic checks (second part)
Implement semantic checks and realted tests for constraints:
C937, C938, C939, C940, C941, C942, C945 (second part),
C946, C947, C948, C949 and C950.

Original-commit: flang-compiler/f18@b4965d272b
Tree-same-pre-rewrite: false
2019-05-03 00:45:22 -07:00
peter klausler
9c369277a5 [flang] Prevent unhandled special formatting
Original-commit: flang-compiler/f18@378e0e2325
Reviewed-on: https://github.com/flang-compiler/f18/pull/441
2019-05-03 16:53:45 -07:00