Commit graph

2091 commits

Author SHA1 Message Date
Tim Keith 721a2c55db [flang] Merge pull request flang-compiler/f18#577 from flang-compiler/tsk-issue572
Allow forward reference to binding name in type-bound generic

Original-commit: flang-compiler/f18@3ed8a8a356
Reviewed-on: https://github.com/flang-compiler/f18/pull/577
2019-07-16 11:09:36 -07:00
Tim Keith 16356d58bc [flang] Allow forward reference to binding name in type-bound generic
Type-bound generic statements can have binding names that refer to
bindings that occur later in the type. So save a map of generic to
binding names and process them when we get to the end of the
type-bound procedure part. This is similar to how specific procedures
of generic identifiers are handled.

Also detect duplicate binding names for a type-bound generic.

Fixes issue flang-compiler/f18#572.

Original-commit: flang-compiler/f18@d58bb77cfa
Reviewed-on: https://github.com/flang-compiler/f18/pull/577
2019-07-15 17:09:03 -07:00
Peter Klausler 66a7639f49 [flang] Merge pull request flang-compiler/f18#565 from flang-compiler/pmk-fixes
When creating symbols for intrinsics, do not put them in the global s…

Original-commit: flang-compiler/f18@38789942a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
2019-07-16 10:55:27 -07:00
peter klausler d3c8af484a [flang] Fix typo
Original-commit: flang-compiler/f18@f7d9f5bd7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
2019-07-16 10:53:39 -07:00
peter klausler 367d3eec60 [flang] Address review comment
Original-commit: flang-compiler/f18@5d6749c3d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:55 -07:00
peter klausler 8f40dbcd19 [flang] Fix flang-compiler/f18#571: forward reference to interface
Original-commit: flang-compiler/f18@5e00d1699c
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:53 -07:00
peter klausler 8c0aa90185 [flang] Handle USE and host associations in characteristics analysis
Original-commit: flang-compiler/f18@1625f72e35
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:51 -07:00
peter klausler 29004ece95 [flang] fix crash in ASSOCIATED() intrinsic with two arguments
Original-commit: flang-compiler/f18@1a393ff43b
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:48 -07:00
peter klausler fc638c021c [flang] Make warning about exponent letters more useful
Original-commit: flang-compiler/f18@9c9aaacd7b
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:47 -07:00
peter klausler 375dcec348 [flang] When creating symbols for intrinsics, do not put them in the global scope, and do not emit them to module files.
Original-commit: flang-compiler/f18@9907026609
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:46 -07:00
jeanPerier 64206257a0 [flang] Merge pull request flang-compiler/f18#552 from flang-compiler/jpr-fix-518
Fix issues flang-compiler/f18#517, flang-compiler/f18#518, and flang-compiler/f18#546

Original-commit: flang-compiler/f18@bc3c549d48
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
2019-07-16 02:20:08 -07:00
Jean Perier 31cab04be7 [flang] Add fix for issue flang-compiler/f18#517
Original-commit: flang-compiler/f18@d9bb6890d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
2019-07-10 08:44:05 -07:00
Jean Perier 93e05161ea [flang] Answer comment: split cannondo new tests
Original-commit: flang-compiler/f18@7ebf7f72b0
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-10 03:53:25 -07:00
Jean Perier 16cf494888 [flang] Add non standard feature for labeled do not ending with END DO or CONTINUE
* The warning was already here, this commit only refactors things so that
 it can be controled with -Mstandard.
* Also makes the warning point to the do-stmt and adds a note to the warning
  pointing to the statements where it ends.

Original-commit: flang-compiler/f18@11e1eb6edd
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-09 11:54:40 -07:00
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 f2d0ae546e [flang] Merge pull request flang-compiler/f18#568 from flang-compiler/tsk-test
Improvements to semantics tests

Original-commit: flang-compiler/f18@4dde0d7daa
Reviewed-on: https://github.com/flang-compiler/f18/pull/568
2019-07-15 17:00:04 -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 937fad77a7 [flang] Merge pull request flang-compiler/f18#576 from flang-compiler/tsk-pass
Procedure distinguishability rules for operators

Original-commit: flang-compiler/f18@fc35c3ed0b
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
2019-07-15 14:22:28 -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 5f9ea62fae [flang] Merge pull request flang-compiler/f18#569 from flang-compiler/pmk-omp
Add source provenance to OpenMP parse tree nodes; clean things up.

Original-commit: flang-compiler/f18@03786ec407
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
2019-07-15 13:27:15 -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 9bb9352a09 [flang] Merge pull request flang-compiler/f18#567 from flang-compiler/tsk-pass-2
Use passed-object dummy in distinguishability checks

Original-commit: flang-compiler/f18@c87fbc387f
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
2019-07-15 12:45:40 -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
Jinxin (Brian) Yang 4370b717f0 [flang] Merge pull request flang-compiler/f18#566 from flang-compiler/by-mp-validity
Add missing THREADS and SIMD clauses

Original-commit: flang-compiler/f18@ade72d803d
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
2019-07-11 16:32:34 -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 b2479a78c6 [flang] Merge pull request flang-compiler/f18#561 from flang-compiler/pmk-fixes
Better name resolution for intrinsics

Original-commit: flang-compiler/f18@33aceaec8f
Reviewed-on: https://github.com/flang-compiler/f18/pull/561
2019-07-11 13:00:21 -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 eb97418b2d [flang] Merge pull request flang-compiler/f18#559 from flang-compiler/tsk-symbols3
Move some functions to semantics/tools.h

Original-commit: flang-compiler/f18@e133247901
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
2019-07-11 08:52:52 -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 ce1f2174e1 [flang] Merge pull request flang-compiler/f18#557 from flang-compiler/pmk-fixes
Fix name resolution for direct recursion; adjust BOZ arguments to intrinsics.

Original-commit: flang-compiler/f18@537a501f47
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
2019-07-10 16:50:43 -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