Commit graph

1658 commits

Author SHA1 Message Date
Jean Perier 8a4b595bf6 [flang] Answer comments
* Support target label of label-do on all executable constructs as well as
  forall and where.
* Re-oder and rename related checks in resolve-labels.cc

Original-commit: flang-compiler/f18@e5ac8a1660
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-09 10:40:14 -07:00
Jean Perier 5597f366e1 [flang] Fix issues 518 and 546
- Only allow out-of-scope label target for label-do-stmt
  when the label is on an end-stmt of a scope directly nested
  into the one of the label-do-stmt.
- Also transform label-do-stmt into non-label-do constructs
  so that later phases do not have to handle label-do-stmt.

Original-commit: flang-compiler/f18@91cff2f296
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-08 09:19:07 -07:00
Tim Keith 4635eb1aac [flang] Improvements to semantics tests
Change test scripts so that cmake passes in the path to the `f18`
that it just built. They no longer have to use relative paths.

Simplify argument passing in test scripts by sharing it in `common.sh`.

Move `if_arith01.f90`, `if_construct01.f90`, `if_stmt01.f90` to `ERROR_TESTS`.
As it was, nothing was being tested on them.

For `test_error.sh`, find the include directory relative to `f18` and
pass that in with a `-I` option. Eliminate the temporary definitions of
`iso_fortran_env`, `iso_c_binding`, `ieee_exceptions` in the tests
because the "real" ones are now available.

The tests that are run with `test_any.sh` could probably have similar
changes, but they are not part of this commit.

Original-commit: flang-compiler/f18@b62fe489be
Reviewed-on: https://github.com/flang-compiler/f18/pull/568
2019-07-12 12:37:16 -07:00
Tim Keith 97e60b7354 [flang] Procedure distinguishability rules for operators
Generic operators and assignment have different rules than generic
names for their procedures being distinguishable.

Implement those rules in `DistinguishableOpOrAssign`. The rules are
considerably simpler: they must have the name number of dummy arguments
and at least one pair in the same position must be distinguishable.

Fixes issue flang-compiler/f18#563.

Original-commit: flang-compiler/f18@276bb08206
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
2019-07-15 13:05:42 -07:00
peter klausler 3d8b3ddef0 [flang] Separate keyword from clauses in provenance of construct directives
Original-commit: flang-compiler/f18@9994d2351e
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
2019-07-15 13:05:30 -07:00
peter klausler ef59f7ad12 [flang] Ensure that provenance is preserved in move ctor/assignment of Verbatim
Original-commit: flang-compiler/f18@fcb5513486
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:30 -07:00
peter klausler 5557fff6e8 [flang] Complete source provenance on OMP constructs (except ATOMIC)
Original-commit: flang-compiler/f18@8f6e93d579
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:29 -07:00
peter klausler 521a9770af [flang] Combine BARRIER/TASKWAIT/TASKYIELD
Original-commit: flang-compiler/f18@c56c893a05
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:28 -07:00
peter klausler 6599bdf9b5 [flang] Convert more empty classes to enums
Original-commit: flang-compiler/f18@9cf8b9eea7
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:28 -07:00
peter klausler 2075e06dff [flang] Change more empty classes into enums
Original-commit: flang-compiler/f18@e73b0368b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:27 -07:00
peter klausler 2d0f9636a8 [flang] Change some empty classes into enums
Original-commit: flang-compiler/f18@652e474556
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:27 -07:00
peter klausler a3242b8107 [flang] more progress
Original-commit: flang-compiler/f18@1a219e5073
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:26 -07:00
peter klausler 1a26c576de [flang] Eliminate a lot of needless indirection in OMP data structures
Original-commit: flang-compiler/f18@47c6cb0ba9
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:25 -07:00
peter klausler b85df73935 [flang] Restore alphabetical order to OpenMP nodes in parse tree dumper
Original-commit: flang-compiler/f18@88b1a26035
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:24 -07:00
peter klausler 51b43e9e48 [flang] Define and use OpenMPConstructDirective
Original-commit: flang-compiler/f18@cd716fa907
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:24 -07:00
peter klausler bdec2cd8c9 [flang] Refinements; builds and passes tests again
Original-commit: flang-compiler/f18@a83410a440
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:23 -07:00
peter klausler 40c797d773 [flang] Add "..."_id token syntax for complete tokens with lookahead
Original-commit: flang-compiler/f18@19695ccfa4
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:22 -07:00
Tim Keith 714d3be8bf [flang] Use passed-object dummy in distinguishability checks
Complete the checks for distinguishable specifics procedure in a generic
by considering any passed-object dummy arguments.

C1514 rule 3 is implemented and the checks for the other rules are
extended to consider the PASS attribute, including the concept of the
"effective" position of an argument in an argument list, computed by
ignoring passed-object arguments.

Add `pass` to `characteristics::DummyArgument` to mark each
passed-object dummy argument.

Change symbols to store the index of the passed-object dummy argument
rather than its symbol.

Check that specifics of a type-bound generic are distinguishable only
after all of the procedure bindings have been processed. They don't have
to be before the generic.

Original-commit: flang-compiler/f18@2751490f95
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
2019-07-12 12:18:00 -07:00
Tim Keith 507cc50866 [flang] Add IsGlobal and IsDerivedType to Scope
These are properties of Scopes that are checked frequently
so add IsGlobal and IsDerivedType for convenience.

Original-commit: flang-compiler/f18@aebb2379d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
Tree-same-pre-rewrite: false
2019-07-12 12:17:56 -07:00
peter klausler ed2213bb51 [flang] Ensure that no OMP clause is a prefix of a later one in the grammar; then alphabetize the order.
Original-commit: flang-compiler/f18@7f4b4f8e74
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
2019-07-11 15:30:32 -07:00
Jinxin Yang ca3dc401a9 [flang] add ORDERED construct w/ THREADS and SIMD clauses (parse error)
Original-commit: flang-compiler/f18@23a71aed74
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
Tree-same-pre-rewrite: false
2019-07-11 15:30:32 -07:00
Jinxin (Brian) Yang 800b96540b [flang] Examples of Composite and Combined constructs (flang-compiler/f18#558)
* Examples of Composite and Combined constructs

2.8.3 Loop SIMD Construct
2.11.1 Parallel Loop Construct
2.11.3 Parallel Loop SIMD Construct

Not in the implementation:
2.8.3 DO SIMD: A list item may appear in a linear or firstprivate clause but not both

Original-commit: flang-compiler/f18@75d9c1a081
Reviewed-on: https://github.com/flang-compiler/f18/pull/558
2019-07-11 15:18:09 -07:00
peter klausler 20dd13e492 [flang] Better name resolution for intrinsics
Original-commit: flang-compiler/f18@31fd9c82e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/561
2019-07-11 11:52:47 -07:00
Tim Keith cc8e1e9e9f [flang] Change two member functions of DerivedTypeDetails to non-member
In `OrderParameterNames` and `OrderParameterDeclarations` it was
always true that `this == &type.get<DerivedTypeDetails>()` which
meant that `this` was redundant.

So convert them to non-member functions in `tools.h` that get the
details from the symbol passed in. This makes life simpler for the
callers.

Original-commit: flang-compiler/f18@81710d4e6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
2019-07-11 08:51:40 -07:00
Tim Keith c37707a5b1 [flang] Move various Instantiate functions to tools.cc
Move these functions from scope.cc, symbol.cc, type.cc into tools.cc:
  Scope::FindOrInstantiateDerivedType
  Scope::InstantiateDerivedType
  Scope::InstantiateIntrinsicType
  Symbol::Instantiate
  DerivedTypeSpec::ProcessParameterExpressions
  DerivedTypeSpec::Instantiate

This eliminates some dependencies in these files on SemanticsContext,
FoldingContext, etc.

It also allows three of the functions to be private to tools.cc
because they are only called from the others.

Original-commit: flang-compiler/f18@48c6efbf95
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tree-same-pre-rewrite: false
2019-07-11 08:51:40 -07:00
Tim Keith ca06058da8 [flang] Fix formatting
Original-commit: flang-compiler/f18@bef7ddd43b
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tree-same-pre-rewrite: false
2019-07-11 08:51:21 -07:00
peter klausler 28f4c5ca2d [flang] Update grammar and a test in light of C1516
Original-commit: flang-compiler/f18@df4ddccde7
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
2019-07-10 16:42:10 -07:00
peter klausler f7057e031c [flang] Add -fxor-operator
Original-commit: flang-compiler/f18@b8365afc91
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:10 -07:00
peter klausler ef061f3e65 [flang] Update tests
Original-commit: flang-compiler/f18@aa18f1bca5
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:09 -07:00
peter klausler caf9e8e624 [flang] Fix name resolution with directly recursive calls.
Original-commit: flang-compiler/f18@b8e8610430
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:09 -07:00
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 5842409864 [flang] Document preprocessing of Fortran comments in macro actual args
Original-commit: flang-compiler/f18@f491b73636
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:07 -07:00
peter klausler 8ccd6b19c4 [flang] Allow BOZ argument to more intrinsics; generalize BOZ conversions in folding
Original-commit: flang-compiler/f18@6df0136ee8
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:06 -07:00
peter klausler b2b1f045d9 [flang] Remove reference to EUC_JP from test
Original-commit: flang-compiler/f18@ca5c812994
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:05 -07:00
peter klausler 03f5723cb6 [flang] Update extension documentation
Original-commit: flang-compiler/f18@40b44b2e3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:05 -07:00
Peter Steinfeld 542264e519 [flang] Improved warning message base on feedback from Peter.
Original-commit: flang-compiler/f18@030f364324
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
2019-07-10 12:53:56 -07:00
Peter Steinfeld 18f2628287 [flang] Changed the warning as recommended.
Original-commit: flang-compiler/f18@7887331705
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
2019-07-10 12:53:56 -07:00
Peter Steinfeld 66e8935dec [flang] Changes related to feedback from pull request flang-compiler/f18#551
- Changed the name a a function to FindOrDeclareEnclosingEntity
 - Changed that function to return a reference rather than a pointer
 - Polished the setting of the IMPLICIT flag on a declared entity in a
 locality-spec
 - Changed a test to remove an unreported error

Original-commit: flang-compiler/f18@0c1a00d7c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
2019-07-10 12:53:56 -07:00
Peter Steinfeld 2ce7432bb8 [flang] Enabling automatic declaration of names in SHARED locality-spec's
Prior to this change, the compiler issued an error message when a name in a
SHARED locality-spec had not been declared explicitly in an enclosing scope.
Presumably, this was done to enforce constraint C1124.  This constraint states
that "A variable-name in a locality-spec shall be the name of a variable in the
innermost executable construct or scoping unit that includes the DO CONCURRENT
statement".  For LOCAL and LOCAL_INIT locality-spec's, we were automatically
creating a local variable in the situation where one had not been explicitly
declared rather than issuing an error message.

The only compiler I could find that implements the SHARED locality-spec was the
PGI compiler, which automatically creates a variable and does not emit an error
message.  Also, @vdonaldson said that he had consulted with a member of the
Fortran standards committee who said that the correct thing was to create a
variable if necessary.

This change has the compiler creating a variable in the enclosing scope of a DO
CONCURRENT statement if necessary.  I also changed a test to adapt to the new
behavior.  I also consolidated the semantic checking for the constraints
associated with all of the locality-spec's.

Original-commit: flang-compiler/f18@d9253a76fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
2019-07-10 12:53:55 -07:00
Jinxin (Brian) Yang 0f8e792455 [flang] 2.8.1 SIMD structural checks (flang-compiler/f18#554)
Straightforward implementation but not including:
* list-item on aligned clause
* nesting check with the ordered construct (parse tree changes needed!)
* list-item attributes check on aligned clause

Original-commit: flang-compiler/f18@cf04d8ad26
Reviewed-on: https://github.com/flang-compiler/f18/pull/554
2019-07-09 14:08:50 -07:00
peter klausler 008e697192 [flang] Fix regressions found in testing
Original-commit: flang-compiler/f18@ea09b191df
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
2019-07-08 16:02:50 -07:00
peter klausler 644b2aabd0 [flang] Support *length character length specifiers
Original-commit: flang-compiler/f18@874b13b7d8
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 14:07:56 -07:00
peter klausler 7a6dabf974 [flang] Resolve merge
Original-commit: flang-compiler/f18@44743f1fa9
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:44:43 -07:00
peter klausler 626a4cfdfc [flang] Document non-standard use of larger INTEGER for sizes
Original-commit: flang-compiler/f18@edc79c4257
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:44:14 -07:00
peter klausler cc2172b6f4 [flang] Fix multi-file compilations in throwaway driver
Original-commit: flang-compiler/f18@7954d0aecf
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:43:42 -07:00
peter klausler e05f539917 [flang] Crash less
Original-commit: flang-compiler/f18@e8ac1a697d
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-03 16:00:26 -07:00
peter klausler d1de4fe462 [flang] Avoid null pointer dereference
Original-commit: flang-compiler/f18@3c108c0edc
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-03 16:00:25 -07:00
Tim Keith 0386490751 [flang] Prevent segfault in DynamicType::IsTkCompatibleWith
Make sure `derived_` is not null before dereferencing it.

This might only happen when there is a previous error. I saw it
compiling a test program where a USEd module was not found.

Original-commit: flang-compiler/f18@2db516556b
Reviewed-on: https://github.com/flang-compiler/f18/pull/550
2019-07-03 15:47:37 -07:00
Peter Steinfeld 5b7b8866b8 [flang] Improved the implementation of "IsCoarray()" suggested by @tskeith.
Original-commit: flang-compiler/f18@efaf5fca2e
Reviewed-on: https://github.com/flang-compiler/f18/pull/542
2019-07-03 13:59:44 -07:00
Peter Steinfeld 02a395dcb7 [flang] Changes in response to comments on pull request flang-compiler/f18#542.
Original-commit: flang-compiler/f18@e156f977d8
Reviewed-on: https://github.com/flang-compiler/f18/pull/542
Tree-same-pre-rewrite: false
2019-07-03 13:50:57 -07:00