Commit graph

1987 commits

Author SHA1 Message Date
Peter Steinfeld
6e12d0810a [flang] Changes to improve messages for DO semantics
I changed two things in the messages produced for DO semantic checks --
 - I changed the source location to be specific to where conflicting names are
 declared.
 - I added the conflicting names to the message.

Original-commit: flang-compiler/f18@f39f9ceeae
Reviewed-on: https://github.com/flang-compiler/f18/pull/510
2019-06-20 17:07:13 -07:00
Tim Keith
bf73b95874 [flang] Merge pull request flang-compiler/f18#509 from flang-compiler/tsk1
Fix CHECK failure on undeclared type parameter

Original-commit: flang-compiler/f18@de95ab7ebe
Reviewed-on: https://github.com/flang-compiler/f18/pull/509
2019-06-20 16:13:38 -07:00
Tim Keith
56b0e2a759 [flang] Fix CHECK failure on undeclared type parameter
In the example below, the compiler gets an internal error when
processing the derived-type-spec for the declaration of `x`.
When the search for type parameter `k` fails it means an error
has already occurred and we should skip that parameter.

```
type :: t(k)
end type
type(t):: x
end
```

Original-commit: flang-compiler/f18@a4bf1922e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/509
2019-06-20 14:23:21 -07:00
psteinfeld
90a5cdeea3 [flang] Merge pull request flang-compiler/f18#504 from flang-compiler/ps-c1123
Expressions in a DO CONCURRENT header should not reference names declared in the header

Original-commit: flang-compiler/f18@8587141832
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
2019-06-20 12:45:27 -07:00
Peter Steinfeld
a26fff722f [flang] Added "const" to a few declarations in response to review comments.
Original-commit: flang-compiler/f18@f93045c523
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
2019-06-20 11:45:17 -07:00
Peter Steinfeld
fe19b37dea [flang] These changes are in response to comments on my pull request for C1123.
Here's a summary of the changes:
 - I renamed a function to ResolveControlExpressions for clarity.
 - I changed the interface to the function to ResolveIndexName for clarity.
 - I simplified the code for walking the "step" and scalar mask expressions in
   a DO CONCURRENT control statements to not check for the presence of optional
   expressions.
 - I added "const" to the declaration of a local variable.
 - I removed some spurious comments from the test dosemantics04.f90.
 - I added two new tests to dosemantics04.f90 to verify cases that were not
   covered in my original test implementation.

Original-commit: flang-compiler/f18@fa5827061a
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
Tree-same-pre-rewrite: false
2019-06-20 09:58:03 -07:00
Peter Steinfeld
88054b3491 [flang] I fixed a problem in C1123. This constraint requires that expressions in a DO
CONCURRENT header not reference names declared in the same header.  To
implement this, I changed the "Pre" function for ConcurrentHeader to walk the
subtree in an order that caused the variables associated with the declared
names to be created before any of the expressions were walked.

I added the test dosemantics04.f90 to test this.

Original-commit: flang-compiler/f18@9f3b552414
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
Tree-same-pre-rewrite: false
2019-06-20 09:58:03 -07:00
Peter Klausler
596a1c6b45 [flang] Merge pull request flang-compiler/f18#508 from flang-compiler/pmk-fixes
Fix a couple bugs with SELECT TYPE(p) from regression tests

Original-commit: flang-compiler/f18@0b25c908da
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
2019-06-19 16:56:31 -07:00
peter klausler
daef068a0b [flang] back out -Mstandard
Original-commit: flang-compiler/f18@a040c4bdef
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
2019-06-19 16:44:36 -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
40b1cc9b62 [flang] Fix a couple bugs with SELECT TYPE(p) from regression tests
Original-commit: flang-compiler/f18@7539a01ecd
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
Tree-same-pre-rewrite: false
2019-06-19 16:34:50 -07:00
Tim Keith
cfcebc54e2 [flang] Merge pull request flang-compiler/f18#506 from flang-compiler/tsk2
Prevent .mod files from being left by tests

Original-commit: flang-compiler/f18@7810c034c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/506
2019-06-19 15:01:14 -07:00
Tim Keith
e9920a6861 [flang] Prevent .mod files from being left by tests
test_symbols.sh and test_folding.sh were running the compiler in the
test directory (e.g. `<build>/test/semantics`). This meant that .mod
files were being left there because they weren't cleaned up.

Change to run the compiler in the temp directory created for each test.
It is deleted at the end so files aren't left behind.

Original-commit: flang-compiler/f18@4f9735ada7
Reviewed-on: https://github.com/flang-compiler/f18/pull/506
2019-06-19 13:18:17 -07:00
Peter Klausler
73644db8aa [flang] Merge pull request flang-compiler/f18#505 from flang-compiler/pmk-not
Fix a couple things, support ALLOCATED

Original-commit: flang-compiler/f18@175cc5f8f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/505
2019-06-19 13:26:28 -07:00
peter klausler
cedf98c165 [flang] Remove extra semicolon
Original-commit: flang-compiler/f18@c94327b56b
Reviewed-on: https://github.com/flang-compiler/f18/pull/505
2019-06-19 12:37:49 -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
c1a9cdb34f [flang] Merge pull request flang-compiler/f18#503 from flang-compiler/pmk-fixes
Fix flang-compiler/f18#499 and flang-compiler/f18#500, enable -fno-exceptions

Original-commit: flang-compiler/f18@7cb2a0af56
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
2019-06-18 16:22:31 -07:00
peter klausler
b6a1fdf5e0 [flang] Force -fexceptions for real arithmetic tests
Original-commit: flang-compiler/f18@532dd3b6df
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
2019-06-18 15:32:20 -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
b3c7a79e2d [flang] -fno-exceptions
Original-commit: flang-compiler/f18@81d09c2053
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
Tree-same-pre-rewrite: false
2019-06-18 14:11:55 -07:00
Peter Klausler
88f3c99f35 [flang] Merge pull request flang-compiler/f18#496 from flang-compiler/pmk-ascii
Support Latin-1 source encodings, generally clean up source character processing

Original-commit: flang-compiler/f18@7a68cf0706
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
2019-06-18 14:01:11 -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
Tim Keith
b3d95433c4 [flang] Merge pull request flang-compiler/f18#502 from flang-compiler/tsk3
Handle nested interface blocks

Original-commit: flang-compiler/f18@a3c6c70b99
Reviewed-on: https://github.com/flang-compiler/f18/pull/502
2019-06-17 13:12:10 -07:00
Tim Keith
7d464b02c6 [flang] Handle nested interface blocks
Interface blocks can be nested if one of the interface bodies
declares a subprogram with a dummy procedure that is specified
by an interface block. See the addition to `modfile07.f90` for
and example.

This didn't work because there was only one copy of each of
`inInterfaceBlock_`, `isAbstract_`, and `genericSymbol_`.
We need these for each active interface block, so replace these
with a stack. A new entry is pushed on the stack when we enter
an `InterfaceStmt` or `GenericStmt` and popped when we leave.

Also in the same example, when declaring the dummy procedure, the
dummy argument is initially an `EntityDetails` but it is replaced
by a `SubprogramDetails` when it is specified by the interface.

Original-commit: flang-compiler/f18@0c468b60b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/502
2019-06-14 15:04:13 -07:00
Jinxin (Brian) Yang
e98f7aeb94 [flang] Merge pull request flang-compiler/f18#501 from flang-compiler/by-mp-isdeviceptr
Add missing IS_DEVICE_PTR and LINK clauses for OpenMP parsing

Original-commit: flang-compiler/f18@76947faa46
Reviewed-on: https://github.com/flang-compiler/f18/pull/501
2019-06-14 09:00:02 -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
Steve Scalpone
55abea96dd [flang] Merge pull request flang-compiler/f18#497 from flang-compiler/sjs-no-rtti
Use -fno-rtti when compiling f18.

Original-commit: flang-compiler/f18@391926949b
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
2019-06-12 21:02:57 -07:00
Steve Scalpone
057fb5c2d0 [flang] Remove extra spaces.
Original-commit: flang-compiler/f18@777bf033b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
2019-06-12 21:01:26 -07:00
Steve Scalpone
43b6209ed9 [flang] Our coding conventions prohibit rtti; enforce with the -fno-rtti compilation flag.
Original-commit: flang-compiler/f18@d2817cc9c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
Tree-same-pre-rewrite: false
2019-06-12 17:01:41 -07:00
Tim Keith
b12a092024 [flang] Merge pull request flang-compiler/f18#494 from flang-compiler/tsk4
Resolve and check names in equivalence sets

Original-commit: flang-compiler/f18@b1cc835872
Reviewed-on: https://github.com/flang-compiler/f18/pull/494
2019-06-12 14:49:32 -07:00
Tim Keith
9d125624f6 [flang] Handle substring of array element in EQUIVALENCE
A substring of an array element is legal as an equivalence object,
e.g. `a(2,3)[4:5]`. Extend `EquivalenceObject` to include the start
of the substring, if any. Split `CheckBound` into `CheckArrayBound`
and `CheckSubstringBound`.

When evaluating bounds in `AddToSet` we can assert they are constant
because all of the error cases should have been detected already.

Original-commit: flang-compiler/f18@0b4050b2d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/494
2019-06-12 12:38:04 -07:00
Tim Keith
9ef62dbb6a [flang] Resolve and check names in equivalence sets
Collect sets of `parser::EquivalenceObject` to process at the end of
the specification part. This is so that names mentioned in the
EQUIVALENCE statement don't trigger implicit declarations.

The `EquivalenceSets` class performs most of the numerous checks
on objects that can be in equivalence sets at all and objects that
can be in them together. It also merges sets when the same object
appears in more than one.

Once equivalence sets are checked they are added to the `Scope`.
Further checks will be necessary after the size and alignment of
variables are computed.

Add `FindUltimateComponent` to simplify checks on ultimate components
of derived types. Use it to implement `HasCoarrayUltimateComponent`
and checks on equivalence objects.

Make `ExpressionAnalyzer::Analyze(Designator)` public so that
`parser::EquivalenceObject` can be analyzed.

Add `GetDefaultKind`, `doublePrecisionKind`, and `quadPrecisionKind`
to `SemanticsContext` so that `defaultKinds_` does not need to be
accessed directly.

Original-commit: flang-compiler/f18@1cc898e5b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/494
Tree-same-pre-rewrite: false
2019-06-11 18:26:48 -07:00
Peter Klausler
b387e7139d [flang] Merge pull request flang-compiler/f18#492 from flang-compiler/pmk-bug491
Fix bug flang-compiler/f18#491 (and replace a misleading name)

Original-commit: flang-compiler/f18@41d0c06701
Reviewed-on: https://github.com/flang-compiler/f18/pull/492
2019-06-11 13:03:58 -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
psteinfeld
83cf7caa56 [flang] Merge pull request flang-compiler/f18#478 from flang-compiler/ps-issue458
Semantic checks for DO controls of type REAL

Original-commit: flang-compiler/f18@b52469ecd1
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
2019-06-11 07:15:40 -07:00
Peter Steinfeld
609e2d753b [flang] Fixed situations where multiple error messages were being emitted.
Original-commit: flang-compiler/f18@ac62cfa9cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
2019-06-10 15:10:32 -07:00
Peter Steinfeld
c97f17a59f [flang] Renamed check.*do.*stmt to check.*do to better conform with the grammar.
Original-commit: flang-compiler/f18@d7419566e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 14:03:24 -07:00
Peter Steinfeld
169b8272e8 [flang] These are additional changes for issue 458, to perform semantic checks on DO
variable and initial, final, and step expressions.

Here's a summary of the changes since my original pull request:

 - I've taken into account the possibility that the DO variable is declared in
   a MODULE.  This required a call to GetUltimate() on the Symbol for the DO
   variable.
 - The previous change exposed problems in the semantic checking for NULLIFY
   and DEALLOCATE statements, so I've included fixes and tests for those.  I
   also added a test for the ALLOCATE statement, even though it was already
   handling this case.
 - I now handle the case where a procedure name is erroneously used as a DO variable.
 - I now handle the case where a pointer to a procedure is erroneously used as
   a DO variable.
 - I now check that the DO expressions are not null.
 - I added tests for all cases listed above.

Original-commit: flang-compiler/f18@219d856fdb
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
3ab209b58e [flang] Changes in response to Peter's comments on a previous pull request.
Specifically, that the conversion of warnings to errors will happen in a
single place in the compiler once we implement warnings as distinct from
errors.  This change made on of the tests invalid.

Also, there's no need to check whether the extension to allow
REAL DO controls is enabled.

Original-commit: flang-compiler/f18@2fae9edd77
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
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