Peter Klausler [Mon, 6 May 2019 15:22:49 +0000 (08:22 -0700)]
[flang] Merge pull request flang-compiler/f18#442 from flang-compiler/pmk-struct-const
Semantics of structure constructors, part 2 of 2
Original-commit: flang-compiler/f18@
2672b41af621370e5d2a0371ee1afa61049984b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/442
peter klausler [Mon, 6 May 2019 15:22:22 +0000 (08:22 -0700)]
[flang] Tweak error message grammar
Original-commit: flang-compiler/f18@
4190b97ecc509328da0877ff1aab5f829e29108c
Reviewed-on: https://github.com/flang-compiler/f18/pull/442
peter klausler [Mon, 11 Mar 2019 22:39:11 +0000 (15:39 -0700)]
[flang] Remove OwningPointer and ForwardReference
Use std::unique_ptr<> with custom deleter for forward-referenced owned pointer.
Move CopyableIndirection into common, add documentation, clean up.
Remove OwningPointer and ForwardReference
Use std::unique_ptr<> with custom deleter for forward-referenced owned pointer.
Use CopyableIndirection
clean up from merge after split
Complete characterization
fold conversions of arrays
Clean up subscripts to constant arrays
Elemental unary operations complete
Support assumed type TYPE(*) in actual arguments
clean up some TODOs
recognize TYPE(*) arguments to intrinsics
Complete folding of array operations
Finish elementwise array folding, add test, debug
characterize intrinsics, fix some bugs
Clean up build
Type compatibility and shape conformance checks on pointer assignments
Original-commit: flang-compiler/f18@
99d734c6213c7188ad7b031258d0163826d562ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/442
Tree-same-pre-rewrite: false
jeanPerier [Mon, 6 May 2019 15:02:23 +0000 (08:02 -0700)]
[flang] Allocate semantic checks (second and last part)
Merge pull request flang-compiler/f18#436 from flang-compiler/jpr-check-allocate
Original-commit: flang-compiler/f18@
f4d89974d29b225c6e799b3988ab1339c3047266
Jean Perier [Fri, 3 May 2019 08:31:48 +0000 (01:31 -0700)]
[flang] Address comments
Original-commit: flang-compiler/f18@
2a6473ce6af3d409fda024915c719ee88db40a78
Jean Perier [Fri, 26 Apr 2019 08:10:04 +0000 (01:10 -0700)]
[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@
b4965d272b1749d554e3d1388c0a7856591741e8
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 6 May 2019 14:48:44 +0000 (07:48 -0700)]
[flang] Merge pull request flang-compiler/f18#441 from flang-compiler/pmk-message-cleanup
Support std::string and CharBlock in formatted messages
Original-commit: flang-compiler/f18@
4b9431bae96db482f4d3088bcfe710fd58a24cb8
Reviewed-on: https://github.com/flang-compiler/f18/pull/441
peter klausler [Fri, 3 May 2019 23:53:45 +0000 (16:53 -0700)]
[flang] Prevent unhandled special formatting
Original-commit: flang-compiler/f18@
378e0e2325077bc73bd6eee7de934f919f5468d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/441
peter klausler [Fri, 3 May 2019 23:07:37 +0000 (16:07 -0700)]
[flang] Support %zu and %ju before special codes; add comments
Original-commit: flang-compiler/f18@
d237d4122b1036b765f491c463b5f2d9abde6ac8
Reviewed-on: https://github.com/flang-compiler/f18/pull/441
Tree-same-pre-rewrite: false
peter klausler [Fri, 3 May 2019 22:17:59 +0000 (15:17 -0700)]
[flang] Add comments
Original-commit: flang-compiler/f18@
3bd10af06be458e2c3eb67089b8248d220e9333a
Reviewed-on: https://github.com/flang-compiler/f18/pull/441
Tree-same-pre-rewrite: false
peter klausler [Fri, 3 May 2019 18:51:14 +0000 (11:51 -0700)]
[flang] Support std::string and CharBlock in formatted messages
fix off-by-one
Original-commit: flang-compiler/f18@
58eb11c5c7239e45285b84ae9064e5802015bf1f
Reviewed-on: https://github.com/flang-compiler/f18/pull/441
Tree-same-pre-rewrite: false
Peter Klausler [Fri, 3 May 2019 21:47:32 +0000 (14:47 -0700)]
[flang] Merge pull request flang-compiler/f18#440 from flang-compiler/pmk1
Changes from code review
Original-commit: flang-compiler/f18@
c945b52b053383bc29afe0fb2d598fce11ff144d
Reviewed-on: https://github.com/flang-compiler/f18/pull/440
peter klausler [Fri, 3 May 2019 21:41:59 +0000 (14:41 -0700)]
[flang] Changes from review
Original-commit: flang-compiler/f18@
feafc0c216ea9cf84253245bf275a28c1f1efe60
Reviewed-on: https://github.com/flang-compiler/f18/pull/440
Peter Klausler [Fri, 3 May 2019 21:40:31 +0000 (14:40 -0700)]
[flang] Merge pull request flang-compiler/f18#439 from flang-compiler/pmk1
Structure constructor semantics, part 1 of 2
Original-commit: flang-compiler/f18@
56f3f7bd908ba36c9e92a8773ffaf26a5ac54094
Reviewed-on: https://github.com/flang-compiler/f18/pull/439
peter klausler [Fri, 3 May 2019 18:29:15 +0000 (11:29 -0700)]
[flang] lib/evaluate work for structure constructors
Original-commit: flang-compiler/f18@
76a192f9c9b009ea52409f25b81dcb7aa2866234
Reviewed-on: https://github.com/flang-compiler/f18/pull/439
Peter Klausler [Fri, 3 May 2019 02:07:01 +0000 (19:07 -0700)]
[flang] Merge pull request flang-compiler/f18#438 from flang-compiler/pmk-fix-pp-noargs
Fix bug flang-compiler/f18#437
Original-commit: flang-compiler/f18@
3dbcc78d7768acebe83af6f8a6fb2f37a125ecbf
Reviewed-on: https://github.com/flang-compiler/f18/pull/438
peter klausler [Thu, 2 May 2019 22:19:37 +0000 (15:19 -0700)]
[flang] Fix f90_correct test failure
Original-commit: flang-compiler/f18@
ff7a5af50bb4305fe903e38216b68724157a6a33
Reviewed-on: https://github.com/flang-compiler/f18/pull/438
peter klausler [Thu, 2 May 2019 21:29:52 +0000 (14:29 -0700)]
[flang] Fix bug flang-compiler/f18#437, func-like macro call with no arguments
Original-commit: flang-compiler/f18@
d106290f196931b9054b1d272c3f53ac47942772
Reviewed-on: https://github.com/flang-compiler/f18/pull/438
Tree-same-pre-rewrite: false
psteinfeld [Wed, 1 May 2019 20:12:49 +0000 (13:12 -0700)]
[flang] Merge pull request flang-compiler/f18#434 from flang-compiler/ps
Tests for C1131, DO loop names
Original-commit: flang-compiler/f18@
d1c94d97ffdd33d6f5f2ed5fe059ae700d9d4df0
Reviewed-on: https://github.com/flang-compiler/f18/pull/434
Peter Steinfeld [Wed, 1 May 2019 19:52:05 +0000 (12:52 -0700)]
[flang] Changed the test for unmatched DO loop names to use test_errors.sh
rather than test_any.sh.
Original-commit: flang-compiler/f18@
c02aff457055febc3529db0f9693005d13375111
Reviewed-on: https://github.com/flang-compiler/f18/pull/434
Peter Steinfeld [Tue, 30 Apr 2019 17:06:25 +0000 (10:06 -0700)]
[flang] Tests for C1131, making sure that names of DO loops match between the loop header and the END DO statement.
Original-commit: flang-compiler/f18@
f42ad1c2fd7aed6947d5ff5305022ed35c51df79
Reviewed-on: https://github.com/flang-compiler/f18/pull/434
Tree-same-pre-rewrite: false
vdonaldson [Wed, 1 May 2019 03:22:02 +0000 (20:22 -0700)]
[flang] reformat Fortran.h (flang-compiler/f18#435)
Original-commit: flang-compiler/f18@
cdbb214339cb8a32b0a4258b0b51e6ba212540d0
Reviewed-on: https://github.com/flang-compiler/f18/pull/435
vdonaldson [Tue, 30 Apr 2019 18:28:16 +0000 (11:28 -0700)]
[flang] Clause 12 semantics -- Check all constraints not otherwise checked (flang-compiler/f18#427)
* Clause 12 semantics
Check all constraints not otherwise checked during parsing or label scope
validation, except for C1201, C1231, and C1233-5. Obvious program
requirements are also checked, except for 12.6.2.2 constant format string
validation.
Original-commit: flang-compiler/f18@
e4ec3436184935c0c09f0b61c01f3cb86d84d0b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/427
Tim Keith [Mon, 29 Apr 2019 21:48:22 +0000 (14:48 -0700)]
[flang] Merge pull request flang-compiler/f18#433 from flang-compiler/tsk4
Fix source positions during parse tree rewriting
Original-commit: flang-compiler/f18@
0bb7289adef77cbc6dd7f06d2aaefa84d0f11a59
Reviewed-on: https://github.com/flang-compiler/f18/pull/433
Tim Keith [Mon, 29 Apr 2019 14:32:59 +0000 (07:32 -0700)]
[flang] Fix source positions during parse tree rewriting
When a StmtFunctionStmt was rewritten as an array element assignment
the subscripts were not getting correct source locations. They need
to be copied from the function args.
Also, the entire array element expression (e.g. `a(i)`) did not have a
source position. This was tricky because there is no source position
in the original parse that matches what we need. So we take the source
position from the beginning of the function name to the end of the last
arg and extend it one more character to include the closing parenthesis.
Change `ActualArgToExpr()` to return `Expr` rather than
`std::optional<Expr>` because callers always call `.value()` on the
result anyway.
Add `WithSource()` utility to update the `source` data member of a
parse tree node.
This bug shows up as incorrect source positions for error messages. For
example, in this program the error (due to real subscript) did not have
a source position:
```
real :: a(10), x, y
a(x) = y
end
```
Original-commit: flang-compiler/f18@
a9bcf68cebe16341e918700ce223baaf66ed441a
Reviewed-on: https://github.com/flang-compiler/f18/pull/433
Tim Keith [Fri, 26 Apr 2019 22:06:58 +0000 (15:06 -0700)]
[flang] Optionally dump all source members of parse tree
In the parse tree dumper, add a compile-time option to dump source
locations for all nodes that have them. This is a useful way to check
if they are correct, especially after parse tree rewrites.
It is enabled by defining `SHOW_ALL_SOURCE_MEMBERS` in `dump-parse-tree.h`.
Original-commit: flang-compiler/f18@
ceae5632e2c5ec4d1083fcac4a9ad39b8ba2c1f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/433
Tree-same-pre-rewrite: false
Tim Keith [Fri, 26 Apr 2019 22:01:09 +0000 (15:01 -0700)]
[flang] Walk source member of Call and Designator
A `source` data member was added to `Call` and `Designator` so
the parse tree visitor needs to visit them.
Original-commit: flang-compiler/f18@
0a620f1a5e008cd41b4ade2fca452a8df68a89f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/433
Tree-same-pre-rewrite: false
Tim Keith [Fri, 26 Apr 2019 16:16:20 +0000 (09:16 -0700)]
[flang] Merge pull request flang-compiler/f18#429 from flang-compiler/tsk1
Continue semantic checking after name resolution error
Original-commit: flang-compiler/f18@
f17c9caf8ea687600c734b0337fda05e5c6ab7aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/429
Tim Keith [Thu, 25 Apr 2019 21:47:39 +0000 (14:47 -0700)]
[flang] Move HasError, SetError to SemanticsContext
Move HasError and SetError into SemanticsContext so that we can do
consistency checks: if a symbol has an error or we want to set the
error flag, check that an error has been reported.
Original-commit: flang-compiler/f18@
4f6e3a04ca4c4d46a55900551ff5f7a0518bdc7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/429
Tim Keith [Thu, 25 Apr 2019 20:18:33 +0000 (13:18 -0700)]
[flang] Continue semantic checking after name resolution error
When an error occurs in name resolution, continue semantic processing
in order to detect other errors. This means we can no longer assume
that every `parser::Name` has a symbol even after name resolution
completes. In `RewriteMutator`, only report internal error for unresolved
symbol if there have been no fatal errors.
Add `Error` flag to `Symbol` to indicate that an error occcurred related
to it. Once we report an error about a symbol we should avoid reporting
any more to prevent cascading errors. Add `HasError()` and `SetError()`
to simplify working with this flag.
Change some places that we assume that a `parser::Name` has a non-null
symbol. There are probably more.
`resolve-names.cc`: Set the `Error` flag when we report a fatal error
related to a symbol. (This requires making some symbols non-const.)
Remove `CheckScalarIntegerType()` as `ExprChecker` will take care of
those constraints if they are expressed in the parse tree. One exception
to that is the name in a `ConcurrentControl`. Explicitly perform that
check using `EvaluateExpr()` and constraint classes so we get consistent
error messages.
In expression analysis, when a constraint is violated (like `Scalar<>`
or `Integer<>`), reset the wrapped expression so that we don't assume it
is valid. A `GenericExprWrapper` holding a std::nullopt indicates error.
Change `EnforceTypeConstraint()` to return false when the constraint
fails to enable this.
check-do-concurrent.cc: Reorganize the Gather*VariableNames functions
into one to simplify the task of filtering out unresolved names. Remove
`CheckNoDuplicates()` and `CheckNoCollisions()` as those checks is
already done in name resolution when the names are added to the scope.
Original-commit: flang-compiler/f18@
bcdb679405906575f36d3314f17da89e3e89d45c
Reviewed-on: https://github.com/flang-compiler/f18/pull/429
Tree-same-pre-rewrite: false
Tim Keith [Fri, 26 Apr 2019 16:04:57 +0000 (09:04 -0700)]
[flang] Merge pull request flang-compiler/f18#430 from flang-compiler/tsk2
Bug fix: resolve ComponentArraySpec
Original-commit: flang-compiler/f18@
612638e4048bc0ad78132a268f74bcf85513cc42
Reviewed-on: https://github.com/flang-compiler/f18/pull/430
Tim Keith [Fri, 26 Apr 2019 15:51:17 +0000 (08:51 -0700)]
[flang] Fix test
Original-commit: flang-compiler/f18@
dfd8cdfdeccb66de92e86194172247b874c60634
Reviewed-on: https://github.com/flang-compiler/f18/pull/430
Tim Keith [Thu, 25 Apr 2019 22:05:41 +0000 (15:05 -0700)]
[flang] Bug fix: resolve ComponentArraySpec
This used to work but broke due to coarray spec changes.
The fix is to extend AnalyzeArraySpec to work on ComponentArraySpec
and to call it when we encounter one.
modfile24.f90 tested this case but had the wrong expected results.
Thanks to Jean for finding this.
Original-commit: flang-compiler/f18@
7ef4c28a6171d95e383bf0b3ad63915ecf9f849a
Reviewed-on: https://github.com/flang-compiler/f18/pull/430
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 24 Apr 2019 18:41:40 +0000 (11:41 -0700)]
[flang] revert last pushes
Original-commit: flang-compiler/f18@
39335746a99c5291b82932f119bc2d25d251f022
Eric Schweitz [Tue, 9 Apr 2019 18:13:48 +0000 (11:13 -0700)]
[flang] fix merge issues
Original-commit: flang-compiler/f18@
20a6d8a159d03813392b93255a72a334d6cde15b
Eric Schweitz [Tue, 9 Apr 2019 16:35:52 +0000 (09:35 -0700)]
[flang] clang-format
Original-commit: flang-compiler/f18@
faa7ccf90584f0cd18e9e02e009c0734ec16c22b
Eric Schweitz [Mon, 1 Apr 2019 18:09:03 +0000 (11:09 -0700)]
[flang] Some initial bridge code
add QualifiedStmt class
Original-commit: flang-compiler/f18@
b2d89fe696f29cb60a8f0aa211b30eb4f7f442d5
Eric Schweitz [Wed, 27 Mar 2019 23:05:11 +0000 (16:05 -0700)]
[flang] start splitting up afforestation so it isn't monolithic
Original-commit: flang-compiler/f18@
ea42c9df5ae6f6825f46d003d8fd8e445f628ab5
Eric Schweitz [Tue, 23 Apr 2019 21:40:04 +0000 (14:40 -0700)]
[flang] fix interface
Original-commit: flang-compiler/f18@
668fd8338dea9ce214451d21f02051935aa5e889
jeanPerier [Wed, 24 Apr 2019 07:53:49 +0000 (00:53 -0700)]
[flang] First batch of semantic checks for allocate
Merge pull request flang-compiler/f18#418 from flang-compiler/jpr-check-allocate
Original-commit: flang-compiler/f18@
ab7d7c5dc0e9b15e9ef7b6ea2eadbc793b282fdb
Jean Perier [Tue, 23 Apr 2019 13:06:33 +0000 (06:06 -0700)]
[flang] fix comment layout
Original-commit: flang-compiler/f18@
ad874f01523b90a58b7825ed02e6c3bea6cd38c8
Jean Perier [Tue, 23 Apr 2019 12:57:50 +0000 (05:57 -0700)]
[flang] Address review comments
Original-commit: flang-compiler/f18@
0c975ed88caadaf8594eb6f7ef70ad32c81905c2
Tree-same-pre-rewrite: false
Jean Perier [Thu, 18 Apr 2019 16:18:37 +0000 (09:18 -0700)]
[flang] Fix allocate in deallocate01.f90 test
Original-commit: flang-compiler/f18@
681e51f50b2c133e03bf174fac7187c3395fbdb1
Tree-same-pre-rewrite: false
Jean Perier [Thu, 18 Apr 2019 16:17:31 +0000 (09:17 -0700)]
[flang] First batch of semantics checks for allocate
Original-commit: flang-compiler/f18@
1019a84ac8666ab1d04b192c544795f13cb6348c
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 22 Apr 2019 20:58:22 +0000 (13:58 -0700)]
[flang] Merge pull request flang-compiler/f18#423 from flang-compiler/pmk-packs
Use parameter packs to simplify parser combinators. Work around g++ …
Original-commit: flang-compiler/f18@
9e178f252551e416a760998d98593a910c43b68d
Reviewed-on: https://github.com/flang-compiler/f18/pull/423
peter klausler [Fri, 19 Apr 2019 23:59:28 +0000 (16:59 -0700)]
[flang] Use parameter packs to simplify parser combinators. Work around g++ bug better.
Original-commit: flang-compiler/f18@
eaa65cd60a2fb6b23fc8696f0e6efdced52a7d54
Reviewed-on: https://github.com/flang-compiler/f18/pull/423
Tim Keith [Mon, 22 Apr 2019 19:58:20 +0000 (12:58 -0700)]
[flang] Merge pull request flang-compiler/f18#424 from flang-compiler/tsk-expr
Distinguish between unanalyzed and error expressions
Original-commit: flang-compiler/f18@
0978d17010d65560e54f18ed6cf972bc66f58820
Reviewed-on: https://github.com/flang-compiler/f18/pull/424
Tim Keith [Mon, 22 Apr 2019 03:46:15 +0000 (20:46 -0700)]
[flang] Change ExprRef to return reference
ExprRef never returns a null pointer so change it to return a reference.
Add overloading for parser::Variable as they now also hold a typedExpr.
Change some of the functions that the result of ExprRef is passed to so
that they take references instead of pointers.
Original-commit: flang-compiler/f18@
2cdab6b166aa71b273b64b1f6cf520d07637b534
Reviewed-on: https://github.com/flang-compiler/f18/pull/424
Tim Keith [Sat, 20 Apr 2019 00:14:50 +0000 (17:14 -0700)]
[flang] Distinguish between unanalyzed and error expressions
When an Expr or Variable is analyzed, always fill in a GenericExprWrapper
for it. That now holds the result of expression analysis which is
std::nullopt when there is an error.
After the ExprChecker pass has finished, the typedExpr data member of
Variables and top-level Exprs should be filled in. Assert that is the
case when we access them.
Original-commit: flang-compiler/f18@
192a4e08554b105c48fcd65e6f8ed4860e64f544
Reviewed-on: https://github.com/flang-compiler/f18/pull/424
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 22 Apr 2019 17:37:07 +0000 (10:37 -0700)]
[flang] Merge pull request flang-compiler/f18#426 from flang-compiler/pmk-425
Fix flang-compiler/f18#425, build fail with libc++
Original-commit: flang-compiler/f18@
b21b3da80896b40ebd42c1a5eab74cd80943736b
Reviewed-on: https://github.com/flang-compiler/f18/pull/426
peter klausler [Mon, 22 Apr 2019 17:10:09 +0000 (10:10 -0700)]
[flang] Fix flang-compiler/f18#425, build fail with libc++
Original-commit: flang-compiler/f18@
96a553b189ceb535a120b1f4d29ddc8e9d4a841c
Reviewed-on: https://github.com/flang-compiler/f18/pull/426
Peter Klausler [Mon, 22 Apr 2019 17:08:20 +0000 (10:08 -0700)]
[flang] Merge pull request flang-compiler/f18#421 from flang-compiler/pmk3
Add some utility functions to semantics/tools
Original-commit: flang-compiler/f18@
80ef214fb8132584dafea20c763223cd7691a9bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/421
peter klausler [Thu, 18 Apr 2019 22:07:40 +0000 (15:07 -0700)]
[flang] Add some utility functions to semantics/tools
Original-commit: flang-compiler/f18@
59006b3a5ce6dba7f15831e60a83153cee998012
Reviewed-on: https://github.com/flang-compiler/f18/pull/421
Tim Keith [Fri, 19 Apr 2019 21:33:04 +0000 (14:33 -0700)]
[flang] Merge pull request flang-compiler/f18#422 from flang-compiler/tsk-expr
Continue semantics checks after expression errors
Original-commit: flang-compiler/f18@
55cf9ee7aab95588fd7a4fc4423d17c2689c074e
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tim Keith [Fri, 19 Apr 2019 19:55:36 +0000 (12:55 -0700)]
[flang] Share code for analyzing Expr and Variable
Move check for empty CharBlock from here to SetLocation.
(Can an Expr ever have an empty source location?)
Original-commit: flang-compiler/f18@
7fd422f02515e4211170ba18fda04cc1405cf084
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tim Keith [Fri, 19 Apr 2019 16:21:12 +0000 (09:21 -0700)]
[flang] Continue semantics checks after expression error
Change statement semantics to continue with checks after an error
in expression analysis. This allows the compiler to report more
compilation errors. It requires that statement semantics not assume
that every parser::Expr has a valid evaluate::Expr.
For example, the test cases in coarrays02.f90 can now be moved to
coarrays01.f90. Previously the errors like "Must be a scalar value"
from ExprChecker prevented other errors from being detected by
CoarrayChecker.
Change to a stable sort of messages so that they come out in a
deterministic order. Otherwise when there are two errors at the
same location (e.g. line 71 of coarrays01.f90) the test can fail
randomly.
Original-commit: flang-compiler/f18@
f420d219096c0f40c17a07d926122840669debb4
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tree-same-pre-rewrite: false
Tim Keith [Fri, 19 Apr 2019 15:22:28 +0000 (08:22 -0700)]
[flang] Use SomeExpr rather than GenericExprWrapper in checkers
Use GetExpr in checker classes to get analyzed expressions out of parse
tree nodes. Don't assume that they are always present. Change the
utility functions in tools.h to use SomeExpr rather than
GenericExprWrapper.
Original-commit: flang-compiler/f18@
594e30d462b0592804b28146a34c74f1d1e2712a
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tree-same-pre-rewrite: false
Tim Keith [Fri, 19 Apr 2019 14:11:19 +0000 (07:11 -0700)]
[flang] Remove redundant checks enforced in the grammar
Expression analysis enforces constraints implied by the grammar,
for example scalar-expr, scalar-int-expr, etc. These no longer need
to be checked during statement semantics.
Original-commit: flang-compiler/f18@
35330b9a85a448453cb5db5f77697091658ddeec
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tree-same-pre-rewrite: false
Tim Keith [Fri, 19 Apr 2019 00:55:24 +0000 (17:55 -0700)]
[flang] Preserve source location when rewriting parse tree
When a Designator is created from a FunctionReference or
StmtFunctionStmt, copy the source data member too.
Original-commit: flang-compiler/f18@
bf91c0630f80a413a374367f0189b7fd21fbab15
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tree-same-pre-rewrite: false
Tim Keith [Fri, 19 Apr 2019 00:48:55 +0000 (17:48 -0700)]
[flang] Save and fetch analyzed Expr in Variable
Add typedExpr data member to Variable like that in Expr.
When expression analysis analyzed a Variable it stores the
resulting evaluate::Expr there.
Add GetExpr overloads in semantics/tools.h for using in statement
semantics. It gets an evaluate::Expr from an Expr, Variable, or
wrapper around one of those. It returns a const pointer so that
clients cannot modify the cached expression (and copies do not
have to be made).
Change CoarrayChecker to make use of GetExpr. It will eventually
replace all references to typedExpr in statement semantics.
Original-commit: flang-compiler/f18@
b02a41efe12032d67cbc99abe43adfb4abb422bb
Reviewed-on: https://github.com/flang-compiler/f18/pull/422
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 18 Apr 2019 22:09:25 +0000 (15:09 -0700)]
[flang] Merge pull request flang-compiler/f18#420 from flang-compiler/pmk2
Flatten and fold array operations
Original-commit: flang-compiler/f18@
8693c80f33805cc48e6141d600e2898f02885173
Reviewed-on: https://github.com/flang-compiler/f18/pull/420
peter klausler [Thu, 18 Apr 2019 21:11:15 +0000 (14:11 -0700)]
[flang] Fold array operations
Original-commit: flang-compiler/f18@
e6c86ecfd10b77aeac63722c08487ae5de0a0c27
Reviewed-on: https://github.com/flang-compiler/f18/pull/420
Peter Klausler [Thu, 18 Apr 2019 21:32:22 +0000 (14:32 -0700)]
[flang] Merge pull request flang-compiler/f18#419 from flang-compiler/pmk1
More work on classes to represent characteristics of procedures.
Original-commit: flang-compiler/f18@
4db875f1dbfff42bbccc5bf54fc5a188cff14c81
Reviewed-on: https://github.com/flang-compiler/f18/pull/419
peter klausler [Thu, 18 Apr 2019 21:27:59 +0000 (14:27 -0700)]
[flang] Return a missing result
Original-commit: flang-compiler/f18@
04f9fd39b91dff2987c87fbcd6db043b6811be02
Reviewed-on: https://github.com/flang-compiler/f18/pull/419
peter klausler [Thu, 18 Apr 2019 21:25:22 +0000 (14:25 -0700)]
[flang] Use Attr_enumSize rather than an arbitrary 32.
Original-commit: flang-compiler/f18@
b6de9c6e47c9429b4c95a5e4dc2624eb0cfb5b9f
Reviewed-on: https://github.com/flang-compiler/f18/pull/419
Tree-same-pre-rewrite: false
peter klausler [Thu, 18 Apr 2019 20:25:20 +0000 (13:25 -0700)]
[flang] More work on classes to represent characteristics of procedures.
Original-commit: flang-compiler/f18@
abd3922a88b585aad829442be2748c46116b77b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/419
Tree-same-pre-rewrite: false
Steve Scalpone [Wed, 17 Apr 2019 21:13:23 +0000 (14:13 -0700)]
[flang] Merge pull request flang-compiler/f18#367 from pawosm-arm/error-stop
Semantics checker for STOP and ERROR STOP statements.
Original-commit: flang-compiler/f18@
e7aedb84ea4704a17a87e7168b7503bb4190858d
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Paul Osmialowski [Tue, 16 Apr 2019 22:17:22 +0000 (23:17 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - trust in implied check
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
7a98732f72649e65fdb1a286ae976aa3f3a9d4a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Paul Osmialowski [Tue, 16 Apr 2019 18:50:52 +0000 (19:50 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - one more batch of post-review tweaks
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
f49ee0df050cce83cc5cdd4c04a3d16465ebeacc
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Tue, 16 Apr 2019 09:32:02 +0000 (10:32 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - remove one more function from tools
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
9937b524fab7408aac9885ce737716047ec3493e
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Tue, 16 Apr 2019 09:30:29 +0000 (10:30 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - fix compilation broken by merge commit
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
1d36ab1f432e9d5de00e072db36e028ac310a8be
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Mon, 15 Apr 2019 19:53:32 +0000 (20:53 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - remove tools function not needed after recent commit
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
1a3dbd97528a0a158cf747c33ab2156c6b48f7a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Fri, 12 Apr 2019 10:43:34 +0000 (11:43 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - remove overhead checks and corresponding test cases
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
6ce6234acc5dbed42fbacc111be075810f65c554
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Thu, 11 Apr 2019 20:43:35 +0000 (21:43 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - better variable names
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
8b32caa287149e72834aad3cdc45473678b57605
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Thu, 11 Apr 2019 20:25:45 +0000 (21:25 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - ExprTypeKindIsDefault added to the tools
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
669b05b27d7ad5bee6689507d40199e941838b9a
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Thu, 11 Apr 2019 18:28:47 +0000 (19:28 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - test file rename
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
b89137b6148d5d515757fb6ea9191ba23681f4c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Thu, 11 Apr 2019 18:27:50 +0000 (19:27 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - namespaces sorted
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
d608779668e1c4f328ebb02dcc21536b2c0fdf2c
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Thu, 11 Apr 2019 17:42:12 +0000 (18:42 +0100)]
[flang] Semantics checker for STOP and ERROR STOP statements - post review changes
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
08b564832c8a2439f35698d55f1d2a4482e6a54d
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Paul Osmialowski [Mon, 18 Mar 2019 16:19:41 +0000 (16:19 +0000)]
[flang] Semantics checker for STOP and ERROR STOP statements.
This commit introduces a new checker (StopChecker) for STOP
and ERROR STOP Fortran statements along with a test code.
Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
Original-commit: flang-compiler/f18@
c5541745628a8c0c4d252386675c36ea83a68006
Reviewed-on: https://github.com/flang-compiler/f18/pull/367
Tree-same-pre-rewrite: false
Tim Keith [Wed, 17 Apr 2019 17:31:49 +0000 (10:31 -0700)]
[flang] Merge pull request flang-compiler/f18#417 from flang-compiler/tsk6
Fix bug resolving internal and module functions
Original-commit: flang-compiler/f18@
ca5d61028286eb2462f7d8ed3be7fc66fadc0f9d
Reviewed-on: https://github.com/flang-compiler/f18/pull/417
Tim Keith [Wed, 17 Apr 2019 14:44:58 +0000 (07:44 -0700)]
[flang] Dump parse tree even if semantic error occurs
When -fdebug-dump-parse-tree is specified, dump the parse tree even
if semantic errors have occurred. This is necessary to see the parse
tree after it has been transformed.
Original-commit: flang-compiler/f18@
bbdb0717da953c959cb1b6c531684952c239b98b
Reviewed-on: https://github.com/flang-compiler/f18/pull/417
Tim Keith [Wed, 17 Apr 2019 14:42:16 +0000 (07:42 -0700)]
[flang] Fix bug resolving internal and module functions
When analyzing a function call in an expression we weren't properly
recognizing a ProcedureDesignator that was the name of an internal
or module function, i.e. a symbol with SubprogramDetails.
The fix is to add IsProcedure to identify symbols that correspond
to procedures. IsFunction and GetType also need to be extended to
handle this case.
Fixes flang-compiler/f18#391.
Original-commit: flang-compiler/f18@
f165f8d38ce0cefd16e0f35644e8fdcbe92ed6de
Reviewed-on: https://github.com/flang-compiler/f18/pull/417
Tree-same-pre-rewrite: false
Peter Klausler [Wed, 17 Apr 2019 15:42:57 +0000 (08:42 -0700)]
[flang] Merge pull request flang-compiler/f18#416 from flang-compiler/pmk-val-fix
Resolve ambiguous I/O unit parse in favor of CharVariable.
Original-commit: flang-compiler/f18@
cd7e907333ee9a0b1a3dfa00fb45d23e1cd6e49f
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
peter klausler [Tue, 16 Apr 2019 23:14:14 +0000 (16:14 -0700)]
[flang] More clean-up
Original-commit: flang-compiler/f18@
ba2365f5f7e0cc029d7fc2ef2729a1b30a9396c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
peter klausler [Tue, 16 Apr 2019 22:59:04 +0000 (15:59 -0700)]
[flang] Generalize tools, clean up common/unwrap.h with new-found knowledge
Original-commit: flang-compiler/f18@
aac16907cd0da6d9b68239f2b1a5c697af58e3f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
peter klausler [Tue, 16 Apr 2019 19:28:18 +0000 (12:28 -0700)]
[flang] Address review comments
Original-commit: flang-compiler/f18@
7bc3c97f1e9d58957049f955ff18aff54a3c1a60
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
peter klausler [Tue, 16 Apr 2019 17:25:22 +0000 (10:25 -0700)]
[flang] Rewrite I/O units in the parse tree when a variable is not character.
Original-commit: flang-compiler/f18@
46791a73e7f181ab4eb7ba2974c52bec07aafaa8
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
peter klausler [Tue, 16 Apr 2019 00:09:48 +0000 (17:09 -0700)]
[flang] Resolve ambiguous I/O unit parse in favor of CharVariable.
Original-commit: flang-compiler/f18@
ecabe82825d9a3a6d70ee77a580072a731eb8f86
Reviewed-on: https://github.com/flang-compiler/f18/pull/416
Tree-same-pre-rewrite: false
jeanPerier [Tue, 16 Apr 2019 08:56:08 +0000 (01:56 -0700)]
[flang] Add software subnormal flushing around host library calls for hosts that cannot do it in HW
Merge pull request flang-compiler/f18#403 from flang-compiler/jpr1
Original-commit: flang-compiler/f18@
31125bb081b454f2879c687338a53fecf6d8945c
Jean Perier [Mon, 15 Apr 2019 08:54:35 +0000 (01:54 -0700)]
[flang] Remove user warning messages for lack of subnormal HW flushing
Original-commit: flang-compiler/f18@
4aecc1bceef9c0a7de6d2dfb57c92b0939943b4b
Jean Perier [Fri, 12 Apr 2019 09:34:56 +0000 (02:34 -0700)]
[flang] also fix accessor name
Original-commit: flang-compiler/f18@
6ff8d22a57ea4dee88580a18d7e5648c492634db
Tree-same-pre-rewrite: false
Jean Perier [Fri, 12 Apr 2019 09:31:54 +0000 (02:31 -0700)]
[flang] address comment. Follow style guideline
Original-commit: flang-compiler/f18@
60da44dc7df4bd438e14fc8d8d4eb6db208f18e8
Tree-same-pre-rewrite: false
Jean Perier [Thu, 11 Apr 2019 14:59:12 +0000 (07:59 -0700)]
[flang] removed unused func in tests
Original-commit: flang-compiler/f18@
4c6e6ad4d05867ab1713c5cdcc3cf051ce43aa8e
Tree-same-pre-rewrite: false
Jean Perier [Thu, 11 Apr 2019 14:51:27 +0000 (07:51 -0700)]
[flang] Add software subnormal flusing around host library call for host arch that do not support it
Original-commit: flang-compiler/f18@
04555f535977b9604f2b89f5eaeb0ac0ee52726e
Tree-same-pre-rewrite: false
Jean Perier [Tue, 9 Apr 2019 11:27:27 +0000 (04:27 -0700)]
[flang] make host subnormal flsuhing control test runtime independent
Original-commit: flang-compiler/f18@
96b25596a7d7f1ece41571624e27bd2b4b5f5339
Tree-same-pre-rewrite: false
Jean Perier [Thu, 4 Apr 2019 14:40:03 +0000 (07:40 -0700)]
[flang] Test host subnormal flushing setup when folding on host
Original-commit: flang-compiler/f18@
78381c897d1a3291a7deba17ed5a8412fa3f3a84
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 15 Apr 2019 23:06:26 +0000 (16:06 -0700)]
[flang] Merge pull request flang-compiler/f18#415 from flang-compiler/pmk-source-variables
Capture source locations for Designators and Calls
Original-commit: flang-compiler/f18@
389423c71866205b7a3dc34f95a9de6f9daf4727
Reviewed-on: https://github.com/flang-compiler/f18/pull/415
peter klausler [Mon, 15 Apr 2019 22:53:18 +0000 (15:53 -0700)]
[flang] Fix bug found in testing
Original-commit: flang-compiler/f18@
45a1e6e3dc25132a2376a19c391242906426e3d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/415
peter klausler [Mon, 15 Apr 2019 22:18:07 +0000 (15:18 -0700)]
[flang] Capture source locations for Designators and Calls
Original-commit: flang-compiler/f18@
970333fff79c0ba1574290ffe965febcd6371125
Reviewed-on: https://github.com/flang-compiler/f18/pull/415
Tree-same-pre-rewrite: false
Tim Keith [Mon, 15 Apr 2019 21:07:11 +0000 (14:07 -0700)]
[flang] Merge pull request flang-compiler/f18#414 from flang-compiler/tsk3
More coarray name resolution and semantic checks
Original-commit: flang-compiler/f18@
3008e8638d91b08e614a3a4619c6e5e387c41cec
Reviewed-on: https://github.com/flang-compiler/f18/pull/414