Commit graph

2075 commits

Author SHA1 Message Date
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
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
psteinfeld
0ddcf62681 [flang] Merge pull request flang-compiler/f18#551 from flang-compiler/ps-shared-locality
Enabling automatic declaration of names in SHARED locality-spec's

Original-commit: flang-compiler/f18@b553d3857c
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
2019-07-10 13:02:52 -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
9b73091758 [flang] Merge pull request flang-compiler/f18#553 from flang-compiler/pmk-fixes
Support "*length" character length specifier on declarations, plus a couple small fixes.

Original-commit: flang-compiler/f18@afe12f7f4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
2019-07-08 16:16:55 -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