Steve Scalpone [Mon, 26 Aug 2019 16:57:06 +0000 (09:57 -0700)]
[flang] Add the OpenMP module.
Original-commit: flang-compiler/f18@
09d8b0d6e1da1435228f339674718881f09a49a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
Steve Scalpone [Tue, 27 Aug 2019 19:00:28 +0000 (12:00 -0700)]
[flang] Merge pull request flang-compiler/f18#681 from DavidTruby/master
Fix for builds with libc++9 and libstdc++10
Original-commit: flang-compiler/f18@
fae1187462a733e64364d2a1a7d908fbed904576
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
David Truby [Fri, 23 Aug 2019 20:17:57 +0000 (21:17 +0100)]
[flang] Misc changes for review
Original-commit: flang-compiler/f18@
6d9ddb8f5e4d5fe478dd2a5908418efb79f61df2
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
David Truby [Fri, 23 Aug 2019 13:52:38 +0000 (14:52 +0100)]
[flang] Fix for builds with libc++9 and libstdc++10
Original-commit: flang-compiler/f18@
137de8a1cdcb6e10d7a020209e0b2d1cb9118885
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
Tree-same-pre-rewrite: false
Tim Keith [Mon, 26 Aug 2019 22:46:49 +0000 (15:46 -0700)]
[flang] Fix bug with statement functions
When the name of a statement function was previously declared, we
weren't correctly recognizing it as a statement function. E.g.
```
integer :: f, i
f(i) = i + 1
```
`f` was entered in the symbol table with `EntityDetails` and the
`parser::Name` on the first line was resolved to that symbol.
On the second line we replaced the symbol for `f` in the scope
with a subprogram symbol, but that didn't change the symbol in
the first `parser::Name`.
The fix requires:
1. don't erase the original symbol for `f`, just replace its details
2. when we erase the symbol for `f` in the subprogram scope, don't
unresolve it
Original-commit: flang-compiler/f18@
31212686ea357503840c0562853c6977bfc1ffe5
jeanPerier [Mon, 26 Aug 2019 08:45:48 +0000 (01:45 -0700)]
[flang] Merge pull request flang-compiler/f18#680 from flang-compiler/jpr-fix-661
Fix issue: Enforce specific intrinsic characteristics
Original-commit: flang-compiler/f18@
0758d8a65e4060a66ba5c755023bb03d0487593b
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
Jean Perier [Fri, 23 Aug 2019 12:37:37 +0000 (05:37 -0700)]
[flang] Fix intrinsic table probing issue with DOUBLE COMPLEX
The probing table was only expecting REAL for kind code
`KindCode::doublePrecision` that is also used for
`DoublePrecisionComplex`.
Add related tests.
Original-commit: flang-compiler/f18@
342ed7e7694da2d71d0c701d5a1163be333cfa01
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
Jean Perier [Fri, 23 Aug 2019 12:03:41 +0000 (05:03 -0700)]
[flang] Fix issue: Enforce specific intrinsic characteristics
Fix issue flang-compiler/f18#661.
The issue was that when probing a specific intrinsic, the
constraints of the related generic intrinsic were tested instead
of the more restrictive constraints of the specific intrinsic.
Original-commit: flang-compiler/f18@
dd971e901d137f0cef9136250402521dbe266288
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
Tree-same-pre-rewrite: false
jeanPerier [Mon, 26 Aug 2019 08:11:34 +0000 (01:11 -0700)]
[flang] Merge pull request flang-compiler/f18#679 from flang-compiler/jpr-fix-676
Fix SELECTED_CHAR_KIND('DEFAULT') folding issue
Original-commit: flang-compiler/f18@
6703f7bd99da33c437df68aafbe855cd1a96ecae
Reviewed-on: https://github.com/flang-compiler/f18/pull/679
Jean Perier [Fri, 23 Aug 2019 10:36:29 +0000 (03:36 -0700)]
[flang] Fix SELECTED_CHAR_KIND('DEFAULT') folding issue
Fix issue flang-compiler/f18#676
The issue was that the 'DEFAULT' case was handled
directly in fold.cc which did not lowercase/trim trailing
space of the argument befaore comparing to "default".
Modify the `Selected_char_kind` function to accept the default
char kind as argument and to return it if the processed argument
matches "default".
Original-commit: flang-compiler/f18@
14222ae9148af4f99f59e6f9f0b928baa2da0b10
Reviewed-on: https://github.com/flang-compiler/f18/pull/679
Peter Klausler [Fri, 23 Aug 2019 18:51:54 +0000 (11:51 -0700)]
[flang] Merge pull request flang-compiler/f18#671 from flang-compiler/pmk-decimal
Better binary<->decimal floating-point conversion
Original-commit: flang-compiler/f18@
5e93f2c602607c70bbb214e3eb59d8fcb8c47d9d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
peter klausler [Fri, 23 Aug 2019 18:14:48 +0000 (11:14 -0700)]
[flang] Make it easier to enable minimal FP output by default for module files (but do not enable it)
Original-commit: flang-compiler/f18@
f6b640319b33008375ca719a88fd0580bcf90bba
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
peter klausler [Thu, 22 Aug 2019 20:58:50 +0000 (13:58 -0700)]
[flang] Cope better with ridiculously large exponents on input
Original-commit: flang-compiler/f18@
e55cc39bad40f6419aadf26101dc6e9c3ed3fda9
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Thu, 22 Aug 2019 19:08:39 +0000 (12:08 -0700)]
[flang] Address most review comments
Original-commit: flang-compiler/f18@
e6164782eac607d376eac59baa9107c971c92c19
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 21 Aug 2019 23:51:23 +0000 (16:51 -0700)]
[flang] Address comments, fix a bug
Original-commit: flang-compiler/f18@
e095bbb23f4e37fe37a1ead03e29f8786c4f9b36
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 21 Aug 2019 18:46:46 +0000 (11:46 -0700)]
[flang] Improve comments, clean up a couple of things
Original-commit: flang-compiler/f18@
8d94d643b64cef9f17eb58cf1095bdec20493965
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 23:59:05 +0000 (16:59 -0700)]
[flang] Fix copyright date on new file.
Original-commit: flang-compiler/f18@
60b1be7ce29ff1c2b6365d44d755c7f33b616313
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 23:57:49 +0000 (16:57 -0700)]
[flang] Correct header guards
Original-commit: flang-compiler/f18@
77688d03926bf256846f2fb79999506f7bfd89b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 23:42:15 +0000 (16:42 -0700)]
[flang] Reenable thorough test
Original-commit: flang-compiler/f18@
431254483e41ecbd667d465d853e46b91ad4ba9b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 23:38:48 +0000 (16:38 -0700)]
[flang] Better unsigned division by constants
Original-commit: flang-compiler/f18@
1b35c24a8aa37f06b7d5ce8b1af636bf15ac979b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 21:35:24 +0000 (14:35 -0700)]
[flang] Clean up some static_casts
Original-commit: flang-compiler/f18@
a5f81388a269e174ee73781c1ed748d992df3dca
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 20:44:11 +0000 (13:44 -0700)]
[flang] Simplify guard bits (only use 3)
Original-commit: flang-compiler/f18@
b710268c1b323c1ce29959eff01d020d5a32283b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 19:58:27 +0000 (12:58 -0700)]
[flang] Work around slow clang-7
Original-commit: flang-compiler/f18@
ed634d72e3d51d56010ef5aedef614f3cda6e076
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 20 Aug 2019 17:05:52 +0000 (10:05 -0700)]
[flang] faster Parse
Original-commit: flang-compiler/f18@
ca97439c6847848bc3f8a52757a73cc3a425e8bb
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Mon, 19 Aug 2019 22:50:21 +0000 (15:50 -0700)]
[flang] Get clean build with gcc
Original-commit: flang-compiler/f18@
e6b5ed152dc318939011597d073bd268465a44f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Mon, 19 Aug 2019 18:45:55 +0000 (11:45 -0700)]
[flang] Simplify decimal->binary
Original-commit: flang-compiler/f18@
01aefbbd7ab91588368f25179749806612ce3fb4
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Fri, 16 Aug 2019 18:13:58 +0000 (11:13 -0700)]
[flang] Make thorough test thorough again
Original-commit: flang-compiler/f18@
c24b10e4347234f6f1a9f127abf0d47f2b954204
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Fri, 16 Aug 2019 18:12:18 +0000 (11:12 -0700)]
[flang] Replace usage of original decimal conversion code with calls to new library
Original-commit: flang-compiler/f18@
7a164451f2b6c920b229a6a666161dd2f936653b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Aug 2019 22:07:27 +0000 (15:07 -0700)]
[flang] Debug test
Original-commit: flang-compiler/f18@
bf2c22bcf494a63cacb7dffcb4e7b209bdc8522c
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Aug 2019 00:05:08 +0000 (17:05 -0700)]
[flang] More testing, added thorough 32-bit sweep test
Original-commit: flang-compiler/f18@
f81b92f91c62822887f12be7fb68d5da816eef47
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Aug 2019 23:21:46 +0000 (16:21 -0700)]
[flang] Testing & debugging
Original-commit: flang-compiler/f18@
f7f933e7f56375c8fe766bf2527472fefca73ad1
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Aug 2019 22:25:16 +0000 (15:25 -0700)]
[flang] Begin adding tests
Original-commit: flang-compiler/f18@
8776d8b66334f8ba0886d074217f0c17cb6aa02b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Aug 2019 20:21:36 +0000 (13:21 -0700)]
[flang] clean up a todo
Original-commit: flang-compiler/f18@
1107bd1f02a978900cc005e72ec2acfe80c198db
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Aug 2019 20:10:10 +0000 (13:10 -0700)]
[flang] Enforce digit limits
Original-commit: flang-compiler/f18@
33600e127dd8ed747d10063d55d8b1eb99bb999b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Wed, 14 Aug 2019 18:53:04 +0000 (11:53 -0700)]
[flang] Add rounding modes
Original-commit: flang-compiler/f18@
9caa1a29a5b8129af087ed55da147b15dc16cde3
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Tue, 13 Aug 2019 23:28:05 +0000 (16:28 -0700)]
[flang] Code snapshot
Original-commit: flang-compiler/f18@
46923344ca8364685c09eb14935382d8989fa0ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
peter klausler [Thu, 25 Jul 2019 17:31:53 +0000 (10:31 -0700)]
[flang] Move leading zero bit count into lib/common
Original-commit: flang-compiler/f18@
1ed184febe6ed4c232d140c69be7d6d1a458aac5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
Tim Keith [Fri, 23 Aug 2019 18:28:33 +0000 (11:28 -0700)]
[flang] Merge pull request flang-compiler/f18#675 from flang-compiler/tsk-modfiles2
Fix bugs in .mod file generation
Original-commit: flang-compiler/f18@
5de0847a64194cc371f62d91d18c2d054c4985c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tim Keith [Fri, 23 Aug 2019 15:28:20 +0000 (08:28 -0700)]
[flang] Add conversions from EnumSet<Attr> to Attrs
This allows operations from EnumSet (e.g. `operator&`) to work as expected.
Original-commit: flang-compiler/f18@
c8b8b742c8cbc675c5e60e8c96533ef36bbbb448
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tim Keith [Thu, 22 Aug 2019 20:57:18 +0000 (13:57 -0700)]
[flang] Fix .mod file bug with IMPORT of USEd name
If a symbol (derived type, for example) was use-associated into a scope
and then imported into a nested interface block, we were not including
the correct IMPORT statement in the .mod file.
This fixes refines the test for when the IMPORT is needed.
Fixes flang-compiler/f18#657.
Original-commit: flang-compiler/f18@
8383de47ecb1b6901e2dd6f290df28fe8a470908
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
Tim Keith [Tue, 20 Aug 2019 21:49:37 +0000 (14:49 -0700)]
[flang] Fix bug in .mod file for some subprogram attributes
Some attributes for subprograms can be in the subprogram prefix but
others cannot. For the latter, emit a separate attribute statement
to specify them. We were already doing that for PRIVATE but not for
OPTIONAL. Those may be the only two attributes this can apply to.
Fixes flang-compiler/f18#659.
Original-commit: flang-compiler/f18@
ae67e087800c5aecb8cb2d2aea16d19b8cc8ccf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
Tim Keith [Tue, 20 Aug 2019 19:05:44 +0000 (12:05 -0700)]
[flang] Fix writing defined operators to .mod files
When defined operators were written to .mod files in USE statement
they did not come out correctly. They have to be emitted with
`PutGenericName()` so that `operator` is included.
Original-commit: flang-compiler/f18@
d40e65a2f9c176f5334adb8132ef65273cf3615f
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Fri, 23 Aug 2019 16:45:03 +0000 (09:45 -0700)]
[flang] [OpenMP] miscellaneous parse tree updates (flang-compiler/f18#673)
1. Big chunk: update comments in parse-tree.h and openmp-grammar.h
with Spec chapter/section info, simple explanation, or productions.
2. Update `To`, `Link`, and `From` clauses with `OmpObjectList` to allow
`/Common Block/`. Spec does not mention whether `Common Block name`
should be accepted or not, so we should assume that these clauses
accept normal `list-item`, which is `Variable`, `Array Section`, or
`Common Block name`.
Original-commit: flang-compiler/f18@
140315cb62da295f6306c2afc737041fa1626dff
Reviewed-on: https://github.com/flang-compiler/f18/pull/673
jeanPerier [Fri, 23 Aug 2019 09:19:36 +0000 (02:19 -0700)]
[flang] Merge pull request flang-compiler/f18#634 from flang-compiler/jpr-fix-604
Fix a crash with IMPORT in BLOCK (issue 604)
Original-commit: flang-compiler/f18@
c0ab1d1ace3b9c27c35f7604470f66b4e6c42cf7
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Jean Perier [Thu, 22 Aug 2019 08:12:20 +0000 (01:12 -0700)]
[flang] Address comment: remove useless const
Original-commit: flang-compiler/f18@
60983f502103575999a91bf62cd0c78aded85837
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Jean Perier [Wed, 21 Aug 2019 13:29:11 +0000 (06:29 -0700)]
[flang] Change Scope::name() to Scope::GetName()
Address comments. Not all scopes are related to
a name. This change makes this more visible to compiler
programers by changing `scope:name()` into `Scope::GetName()`
that returns an optional `SourceName` instead of always
returning a `SourceName` and dying when it cannot.
Original-commit: flang-compiler/f18@
0addb79919f69a6530b0919356a24e68f21507c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
Jean Perier [Wed, 21 Aug 2019 12:33:03 +0000 (05:33 -0700)]
[flang] Use value semantic for SourceName
Change all SourceName* to std::optional<SourceName> because
SourceName is small enough (16 bytes) to be passed and stored
by value which avoid having to worry about life-time, storage and
value constance issues that comes with pointers.
Original-commit: flang-compiler/f18@
73fc08d7bd956b1b793f8930164f9b4ebb7e279c
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
Jean Perier [Wed, 7 Aug 2019 17:18:30 +0000 (10:18 -0700)]
[flang] Fix test copyright year.
Original-commit: flang-compiler/f18@
25819aaf7aa483bd86e5ede227a19efb6f67265e
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
Jean Perier [Wed, 7 Aug 2019 17:14:28 +0000 (10:14 -0700)]
[flang] Fix a crash with IMPORT in BLOCK (issue 604)
Only call scope.name() if the scope has a symbol (Block, Global,
Forall and ImpliedDo kind of scopes do not have a symbol).
Original-commit: flang-compiler/f18@
81c6b67dd2cbb926aba967d9ce2b8973355ca737
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Thu, 22 Aug 2019 17:34:15 +0000 (10:34 -0700)]
[flang] [OpenMP] Canonicalization framework (flang-compiler/f18#599)
* [OpenMP] Canonicalization framework
This is mainly designed for loop association work but can be used for others,
and `CanonicalizeOmp` must be after `CanonicalizeDo`.
At the `Block` level, recognize legal sequence of `OpenMPLoopConstruct`,
`DoConstruct`, and `OmpEndLoopDirective`. Move available `DoConstruct`
and optional `OmpEndLoopDirective` into `OpenMPLoopConstruct`. Throw error
messages if:
1. `DoConstruct` is not following `OpenMPLoopConstruct`
2. `OmpEndLoopDirective` is not following associated do-loop
Once this pass this done, Semantics will not proceed if error exists.
* Update on reviews
1. extract matching and move part into its own function (once `DoConstruct`
is moved, see whether `OpenMPEndLoopDirective` is available)
2. Use a template function to access construct from ExecutionPartConstruct.
3. Move this code into namespace semantics
Original-commit: flang-compiler/f18@
52979f1e93f40c31e04118067403a258555d139a
Reviewed-on: https://github.com/flang-compiler/f18/pull/599
jeanPerier [Thu, 22 Aug 2019 12:49:15 +0000 (05:49 -0700)]
[flang] Merge pull request flang-compiler/f18#672 from flang-compiler/jpr-fix-574
Handle AssocEntityDetails in mis-parsed function reference
Original-commit: flang-compiler/f18@
0006272bbd79f1d4073d52516e0672911108138a
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
Jean Perier [Wed, 21 Aug 2019 09:42:34 +0000 (02:42 -0700)]
[flang] Add comments and tests for issue 574 fix
Original-commit: flang-compiler/f18@
89337cefc7f22944ab53347f97261cb6038a628f
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
Jean Perier [Tue, 20 Aug 2019 13:15:52 +0000 (06:15 -0700)]
[flang] Handle AssocEntityDetails in mis-parsed function reference
Fix issue flang-compiler/f18#574.
Array references can be mistaken for function references during
parsing. This is handled and fixed by semantics. however, if the
symbol in the misparsed array reference was construct associated,
then semantics was not handling the case correctly because
semantics was only expecting `ObjectEntityDetails`.
It was not possible to change the related `GetUltimate` into
`GetAssociationRoot` because associated symbols are not always
associated to another symbol (variable) but may be assoicated to
an expression. Hence, this change allow `AssocEntityDetails` to
be also accepted when dealing with array references misparsed as
function references.
Original-commit: flang-compiler/f18@
b6a8b5f42bdb40d65f4c242a3673bc436a2d0601
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 21 Aug 2019 18:21:01 +0000 (11:21 -0700)]
[flang] Merge pull request flang-compiler/f18#668 from schweitzpgi/master
Add mlir-tablegen for FIR ops
Original-commit: flang-compiler/f18@
f6eec72eead759713287dddc124fea375c4f65db
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
Eric Schweitz [Sat, 17 Aug 2019 02:01:49 +0000 (19:01 -0700)]
[flang] Add FIR dialect header
Original-commit: flang-compiler/f18@
3c902e04d7db782ffecdbee937b4b9e3b35b5551
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
Eric Schweitz [Fri, 16 Aug 2019 23:14:22 +0000 (16:14 -0700)]
[flang] Add mlir-tablegen for FIR ops
Original-commit: flang-compiler/f18@
aae4b525dab5192ab7bc2d9004014025cfd9c64f
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
Tree-same-pre-rewrite: false
psteinfeld [Wed, 21 Aug 2019 04:08:04 +0000 (21:08 -0700)]
[flang] Merge pull request flang-compiler/f18#663 from flang-compiler/ps-c1129
Checks for constraint C1129
Original-commit: flang-compiler/f18@
f724efb6836a404ef83b9ce240dfddfc1066cb2e
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Peter Steinfeld [Tue, 20 Aug 2019 22:17:51 +0000 (15:17 -0700)]
[flang] Responses to comments on the pull request:
- I removed the redundant test s3() from dosemantics90.f90
- I changed the error messages to state "LOCAL locality-spec" rather than just
"locality-spec"
- I changed the names of a couple of variables/parameters in check-do.cc to
make the code more understandable.
Original-commit: flang-compiler/f18@
bcc6291e8370d97cb3d4c23a30e676bf3a0012ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Peter Steinfeld [Wed, 14 Aug 2019 19:57:09 +0000 (12:57 -0700)]
[flang] Changes to implement constraint C1129
"C1129 A variable that is referenced by the scalar-mask-expr of a concurrent-header or by any concurrent-limit or concurrent-step in that concurrent-header shall not appear in a LOCAL locality-spec in the same DO CONCURRENT statement."
In the process of implementing these checks, I found and fixed some other problems. I also cleaned up some of the code in check-do.cc. I ran into two notable difficulties in implementing these checks. First, the symbols associated with the names in a locality spec get created when the locality specs are process during name resolution. Thus, they're different from the symbols associated with names that appear in the control expressions. At Tim's suggestion, I dealt with this by looking up the symbols from the names in the locality spec starting with the closest enclosing scope containing the DO construct. Second, the symbols can be hidden behind host- use- and construct-associations.
Original-commit: flang-compiler/f18@
055788c2f0604c5bd37637732aec863f8e3aebf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false
Peter Steinfeld [Thu, 8 Aug 2019 22:54:49 +0000 (15:54 -0700)]
[flang] Clean-up of check-do.cc
I got rid of duplicate functions that test for a procedure being PURE, renamed
the type SymbolContainer to SymbolSet, and moved some functions into the class
where they're referenced.
Original-commit: flang-compiler/f18@
e48bfdf5737d102b2fa8faedb0f002faf5f30a7e
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Tue, 20 Aug 2019 17:30:29 +0000 (10:30 -0700)]
[flang] [OpenMP] miscellaneous parse tree fix (flang-compiler/f18#669)
Fix `aligned(argument-list[ : alignment])` for `declare simd`
(original implementation will throw parser error if `: alignment` is present.
Original-commit: flang-compiler/f18@
f3f50f9ad3b77174d0054011a17c8e4d3af50d98
Reviewed-on: https://github.com/flang-compiler/f18/pull/669
Jinxin (Brian) Yang [Tue, 20 Aug 2019 17:23:56 +0000 (10:23 -0700)]
[flang] [OpenMP] parse tree fix for `Declare Target` (flang-compiler/f18#670)
The original implementation will throw parsing error for multiple
clauses on `declare target` directive, for example:
```
!$omp declare target to(Q) link(R)
```
Based on the OpenMP Spec, we only need two types for the specifier:
```
!$omp declare target (extended-list)
```
or
```
!$omp declare target [clause[ [,] clause] ... ]
```
This fix makes `declare target` accepts either the `list` or `clauses`,
which is more general and better for error messages.
Adjusted existing test for checking the parse tree changes. More tests
will be added during Semantics.
Original-commit: flang-compiler/f18@
60f47fc1a15803001d9251d8d8e3c53cf979ccc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/670
Tim Keith [Tue, 20 Aug 2019 14:38:04 +0000 (07:38 -0700)]
[flang] Merge pull request flang-compiler/f18#655 from flang-compiler/tsk-issue649
Special handling for VOLATILE and ASYNCHRONOUS
Original-commit: flang-compiler/f18@
75a57c59d244303844291f990f9487a69f290b73
Reviewed-on: https://github.com/flang-compiler/f18/pull/655
Tim Keith [Tue, 13 Aug 2019 20:50:24 +0000 (13:50 -0700)]
[flang] Special handling for VOLATILE and ASYNCHRONOUS
The VOLATILE and ASYNCHRONOUS attributes are special in two ways:
- they can be applied to use-associated variables
- if they are applied to a host-associated variable in a block, that
variable has the attribute only within the scope of the block
The latter is implemented by making a new `HostAssocDetails` symbol
within the block where the attribute can be set without affecting the
variable in the outer scope. This is similar to how the SHARED locality
spec is implemented.
Fixes flang-compiler/f18#649.
Original-commit: flang-compiler/f18@
471aba451341a65ff6014bbe30cb2c64cf905da6
Reviewed-on: https://github.com/flang-compiler/f18/pull/655
Peter Klausler [Fri, 16 Aug 2019 18:03:17 +0000 (11:03 -0700)]
[flang] Merge pull request flang-compiler/f18#666 from flang-compiler/pmk-warnings
Fix bug flang-compiler/f18#665, enable more warnings, deal with fallout
Original-commit: flang-compiler/f18@
5762c2d88bd6844895bccf1226fd6301721a98c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
peter klausler [Thu, 15 Aug 2019 21:25:05 +0000 (14:25 -0700)]
[flang] Another pass with clean builds
Original-commit: flang-compiler/f18@
e05dc1f4440fc42f0264f50cc01b4eb072d4c10f
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
peter klausler [Thu, 15 Aug 2019 20:50:27 +0000 (13:50 -0700)]
[flang] Enable more warnings, deal with fallout
Original-commit: flang-compiler/f18@
65c5b485afe521dab57c35991c96826612ef1d79
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Aug 2019 18:54:51 +0000 (11:54 -0700)]
[flang] Clean up all newly enabled warnings
Original-commit: flang-compiler/f18@
34a917c761541d7325156baafab47966264f2a3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
peter klausler [Thu, 15 Aug 2019 17:17:31 +0000 (10:17 -0700)]
[flang] Enable some new warnings, clean up some of their consequences
Original-commit: flang-compiler/f18@
b82d1e9ac90723406ae93c15061d1ee8326468ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
jeanPerier [Fri, 16 Aug 2019 08:03:19 +0000 (01:03 -0700)]
[flang] Merge pull request flang-compiler/f18#635 from flang-compiler/jpr-fix-547
Fix IMPLICIT issue 547
Original-commit: flang-compiler/f18@
f4f31f179bb1aad1ea0ea669949e202a32b2d65f
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Jean Perier [Thu, 15 Aug 2019 06:55:16 +0000 (23:55 -0700)]
[flang] Address review comments
Rename SetType to SetTypeMapping and change argumnet names.
Style changes.
Original-commit: flang-compiler/f18@
3860097815fd4e20c8c81f809c9891e163678c6a
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Jean Perier [Thu, 8 Aug 2019 15:38:01 +0000 (08:38 -0700)]
[flang] Transform implict none ternaries to bool in `ImplicitRules`
Original-commit: flang-compiler/f18@
324567bd2de6722d5e370f5c7ddc46b28762e945
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Tree-same-pre-rewrite: false
Jean Perier [Thu, 8 Aug 2019 14:20:12 +0000 (07:20 -0700)]
[flang] Fix IMPLICIT issue 547
So far, in `ImplicitRules` class, `isImplicitNoneType_` is a ternary
unset -> nothing about implicit in this scope, look into parents
set true -> There is an IMPLICIT NONE for types in this scope.
set to false -> There is an IMPLICIT statement mapping types in
this false.
However, it was never set to false, so the IMPORT NONE of parent scopes
was "leaking" when it should not.
Set `isImplicitNoneType_` to false if an IMPLICIT statement is met to
fix the issue.
However, this change made the current name-resolution to then completly
disregard parent scope IMPLICIT NONE even for letters for which no
mapping were defined in the current scope. To fix this `GetType` was
modified to check for implicit none.
This led to `ApplyImplicitRules` to do redudant check, so it was
reorganised to querry for a type and complain if gets a nuulptr.
`GetImplicitType` was modified to avoid redundant error message.
Original-commit: flang-compiler/f18@
962dbf3d8be5dc1a6780544bf1be5a803b6d7724
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Tree-same-pre-rewrite: false
Steve Scalpone [Thu, 15 Aug 2019 21:54:05 +0000 (14:54 -0700)]
[flang] Merge pull request flang-compiler/f18#660 from flang-compiler/sjs-c-chars
Define the named constants for the C characters with special semantics
Original-commit: flang-compiler/f18@
9c4ce244ad0447b923964431cf3b9f772fa03af0
Reviewed-on: https://github.com/flang-compiler/f18/pull/660
Steve Scalpone [Wed, 14 Aug 2019 17:36:29 +0000 (10:36 -0700)]
[flang] Use ACHAR() instead of the nonstandard backslash escape sequences.
Original-commit: flang-compiler/f18@
103ed895fe27ae0f4503a4cf379132392dc14788
Reviewed-on: https://github.com/flang-compiler/f18/pull/660
Steve Scalpone [Wed, 14 Aug 2019 03:41:43 +0000 (20:41 -0700)]
[flang] Define the named constants for the C characters with
special semantics in the ISO_C_BINDING intrinsic module.
Original-commit: flang-compiler/f18@
bee546fdb22bd0a4f0a287e623fcb69ceafeb976
Reviewed-on: https://github.com/flang-compiler/f18/pull/660
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Wed, 14 Aug 2019 22:16:27 +0000 (15:16 -0700)]
[flang] [OpenMP] parse tree changes for `OpenMPLoopConstruct` (flang-compiler/f18#656)
1. Following Block and Sections constructs, re-structure loop related
constructs into `{Begin, Loop, End}`. Being part of the work in
PR flang-compiler/f18#599, the `Loop` and `End` nodes are optional during parser. They
should be filled in during the phase of `CanonicalizationOfOmp`. This
commit is solely for the parse tree change. So, after this commit,
PR flang-compiler/f18#599 needs to be changed accordingly.
2. Removed parse tree nodes for `END DO` and `END DO SIMD`. Similar to
Block and Sections constructs, `End` node now accepts clauses too,
the validity checks are deferred into Semantics. This is more genernal
and error message could be better.
3. With this commit alone, assertion error would occur when `End` directive
is present, for example `!$OMP END DO` because the `End` node is not
moved into `OpenMPLoopConstruct` yet. Again, PR flang-compiler/f18#599 will handle that.
More tests will be added in PR flang-compiler/f18#599 and during the future Semantics work.
Original-commit: flang-compiler/f18@
8cd1932fd61fa67f8ad5abfd337cf7a223ea89f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/656
Steve Scalpone [Wed, 14 Aug 2019 19:21:43 +0000 (20:21 +0100)]
[flang] Merge pull request flang-compiler/f18#662 from flang-compiler/sjs-dcmplx
Add dcmplx to the intrinsic table and extensions documentation.
Original-commit: flang-compiler/f18@
8e0c2dea823c3e41324aabc6b2755d373d51a955
Reviewed-on: https://github.com/flang-compiler/f18/pull/662
Steve Scalpone [Wed, 14 Aug 2019 18:32:32 +0000 (11:32 -0700)]
[flang] Add dcmplx to the intrinsic table and extensions documentation.
Formatting change to dimag intrinsic table entry.
Original-commit: flang-compiler/f18@
7f9237531ca346306ff97ad99e11ea11c7fe0a49
Reviewed-on: https://github.com/flang-compiler/f18/pull/662
Jinxin (Brian) Yang [Wed, 14 Aug 2019 15:42:28 +0000 (08:42 -0700)]
[flang] [OpenMP] parse tree changes for Sections/Parallel Sections constructs (flang-compiler/f18#652)
```
!$omp sections [clause[ [,] clause] ... ]
[!$omp section]
structured-block
[!$omp section
structured-block]
...
!$omp end sections [nowait]
```
1. Following parse tree node changes for Block constructs, changing the
Sections/Parallel Sections to `{Begin, Section-Blocks, End}`
2. Handles `!$omp section` in the parser, do not create parse tree node
for this directive because basically it is a delimiter to split the
code into different `Block`s within the Sections/Parallel Sections
constructs. So, the `Section-Blocks` here is a `std::list` of `Block`s.
(thanks to Tim's suggestion)
3. Modify check-omp-structure.* to avoid breaking existing tests
More tests will be added during Semantics. Also, similar to Block constructs,
the `Begin` and `End` directive matching will be done in future PR.
This commit also contains Peter's important fix for allowing "!$OMP END SECTION"
as a legal statement following `Block` (daf5630: Modify execution part error
recovery to not consume !$OMP SECTION).
Original-commit: flang-compiler/f18@
75d016f6d27e73f5d559fe68d8a01df251c6d8cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/652
Steve Scalpone [Wed, 14 Aug 2019 01:29:40 +0000 (02:29 +0100)]
[flang] Merge pull request flang-compiler/f18#653 from flang-compiler/sjs-throwaway-wrapper2
Create a throwaway wrapper for the throwaway driver.
Original-commit: flang-compiler/f18@
5ef563285e431a82a4c21527852a83301f0ed84c
Reviewed-on: https://github.com/flang-compiler/f18/pull/653
Steve Scalpone [Tue, 13 Aug 2019 23:02:03 +0000 (16:02 -0700)]
[flang] Change the suffix of the module files to be .f18.mod
so makefiles with "rm *.mod" will still work. Add a
new option to f18, -intrinsic-module-directory, which
supplies a directory in which f18 searches for standard
intrinsic modules. Neither the option nor the path is passed to F18_FC.
Original-commit: flang-compiler/f18@
0bbda4c39edf170d3c194e4ad16b07e88995e46c
Reviewed-on: https://github.com/flang-compiler/f18/pull/653
Steve Scalpone [Tue, 13 Aug 2019 04:40:03 +0000 (21:40 -0700)]
[flang] Create a throwaway wrapper for the throwaway driver.
Add a script called flang to the bin directory that calls
f18 with the -I option pointing to the module files for the
predefined modules. The wrapper also sets the module suffix
to .fmf to avoid naming conflicts with module files generated
by other compilers. Now, the build creates and installs both
.mod and .fmf files for the predefined module files to
accommodate the flang script.
Original-commit: flang-compiler/f18@
b6c30284e7876f6ccd4bb024bd5f349128e99b7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/653
Tree-same-pre-rewrite: false
Steve Scalpone [Tue, 13 Aug 2019 16:53:33 +0000 (17:53 +0100)]
[flang] Merge pull request flang-compiler/f18#654 from flang-compiler/sjs-dimag
Add an entry to the intrinsics table for dimag.
Original-commit: flang-compiler/f18@
daa2d7537e56341ef60284c60d5a6e3922ddb686
Reviewed-on: https://github.com/flang-compiler/f18/pull/654
Steve Scalpone [Tue, 13 Aug 2019 14:31:50 +0000 (07:31 -0700)]
[flang] Add an entry to the intrinsics table for dimag.
Also, document extensions dconjg and dimag.
Original-commit: flang-compiler/f18@
21535280ee2c3ed7e0e33b70be3fcd844ab5f541
Reviewed-on: https://github.com/flang-compiler/f18/pull/654
Tim Keith [Tue, 13 Aug 2019 16:52:04 +0000 (09:52 -0700)]
[flang] Merge pull request flang-compiler/f18#650 from flang-compiler/tsk-modfiles
Fix bugs writing .mod files
Original-commit: flang-compiler/f18@
a7f90a3c77a7e4fe780baedb295967d0bd175f20
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tim Keith [Mon, 12 Aug 2019 22:29:58 +0000 (15:29 -0700)]
[flang] Fix bug writing character array constructor to .mod file
Character literals in an array constructor were always written
with no kind prefix, so if kind was not 1 they were incorrect.
`c4a` in `modfile28.f90` was an example of this.
Change it to always include the kind as is done with non-array
character literals.
Original-commit: flang-compiler/f18@
4f4caa700639b87503729f69f13d5e0ec0e20583
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tim Keith [Mon, 12 Aug 2019 21:06:06 +0000 (14:06 -0700)]
[flang] Small .mod file fixes
- Only emit initializations for parameters and derived type components.
- Use `=>` for pointer initializations.
- Don't emit intrinsic symbols.
Original-commit: flang-compiler/f18@
b91748c053a11349f85645c65b870fab222ea135
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tree-same-pre-rewrite: false
Tim Keith [Mon, 12 Aug 2019 20:50:45 +0000 (13:50 -0700)]
[flang] Fix source location of some symbol names
Symbols can be declared across multiple statements. The CharBlock
that is used for the symbol name is from the first of these.
Sometimes that is not the best choice. If a name appears in a
type-declaration-stmt or a derived-type-stmt, that occurrence is a
better choice. Errors referencing that symbol should normally point
at that name (not its appearance in an earlier PUBLIC statement,
for example).
Also, the order of symbols in .mod files is based on the order of
their names in the cooked source. Here is an example where it is
necessary to sort `a` based on where its type-declaration-stmt
occurs rather than the first occurrence of `a`:
```
public :: a
type t
end type
type(t), parameter :: a = t()
```
The fix is to add `Symbol::ReplaceName()` so that we can update the
CharBlock for a symbol name when a better one is found, without
changing the actual characters that make up the name.
Original-commit: flang-compiler/f18@
5544f163486df1da80d0e343282afc18ce057672
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tree-same-pre-rewrite: false
Tim Keith [Mon, 12 Aug 2019 20:06:59 +0000 (13:06 -0700)]
[flang] Write function result to .mod file after dummy args
The function result can depend on the declaration of the dummy
arguments so it should be written to the .mod file after them.
For example:
```
function f(x)
integer :: x(:)
integer :: f(size(x))
end
```
Original-commit: flang-compiler/f18@
f6c8c58c24368ae9f209b2c03637531ed869adeb
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Mon, 12 Aug 2019 23:08:10 +0000 (16:08 -0700)]
[flang] [OpenMP] parse tree changes for Critical Construct (flang-compiler/f18#641)
Simple changes: add source provenance for directive itself and renaming
Original-commit: flang-compiler/f18@
9246d266b0b5854db4f1f8beaf47cac80fcf7f0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/641
Peter Klausler [Mon, 12 Aug 2019 23:04:24 +0000 (16:04 -0700)]
[flang] Merge pull request flang-compiler/f18#646 from flang-compiler/pmk-fix-643
Fix bug flang-compiler/f18#643
Original-commit: flang-compiler/f18@
f8368e30e098f5cc2f87288e938e2ce08542e005
Reviewed-on: https://github.com/flang-compiler/f18/pull/646
peter klausler [Mon, 12 Aug 2019 17:56:18 +0000 (10:56 -0700)]
[flang] Fix bug flang-compiler/f18#643
Original-commit: flang-compiler/f18@
29bb4312e1f2861fa04f847c8e552ca894989593
Reviewed-on: https://github.com/flang-compiler/f18/pull/646
Peter Klausler [Mon, 12 Aug 2019 19:29:51 +0000 (12:29 -0700)]
[flang] Merge pull request flang-compiler/f18#648 from flang-compiler/pmk-fix-642
Fix bug flang-compiler/f18#642
Original-commit: flang-compiler/f18@
319c083673ca135d375e4977e6cedd4133c4bdf5
Reviewed-on: https://github.com/flang-compiler/f18/pull/648
peter klausler [Mon, 12 Aug 2019 19:10:43 +0000 (12:10 -0700)]
[flang] Fix bug flang-compiler/f18#642
Original-commit: flang-compiler/f18@
d898b29285b65fea4a43cc4901623decec481c1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/648
Peter Klausler [Mon, 12 Aug 2019 17:31:53 +0000 (10:31 -0700)]
[flang] Merge pull request flang-compiler/f18#645 from flang-compiler/pmk-fix-644
Fix bug flang-compiler/f18#644, always enable backslash escapes when reading module files
Original-commit: flang-compiler/f18@
4ade6c36755fbf343af1db6e657fb5de6eb49ec4
Reviewed-on: https://github.com/flang-compiler/f18/pull/645
peter klausler [Mon, 12 Aug 2019 17:11:59 +0000 (10:11 -0700)]
[flang] Fix bug flang-compiler/f18#644, always enable backslash escapes when reading module files
Original-commit: flang-compiler/f18@
f1c897cedad109e3cccea9fa914d12c529c15742
Reviewed-on: https://github.com/flang-compiler/f18/pull/645
psteinfeld [Sat, 10 Aug 2019 15:18:51 +0000 (08:18 -0700)]
[flang] Merge pull request flang-compiler/f18#637 from flang-compiler/ps-do-tests
Tests for DO loop semantics
Original-commit: flang-compiler/f18@
960d76131e46ccb2ff704ab2bdbc070dff8cd279
Reviewed-on: https://github.com/flang-compiler/f18/pull/637
Peter Steinfeld [Fri, 9 Aug 2019 18:34:31 +0000 (11:34 -0700)]
[flang] - ieee_exceptions.f90: I added all of the routines listed in table 17.3 of the standard that were not currently specified. I also re-ordered the routines to be in the same order as the standard.
- doconcurrent01.f90: I removed the custom versions of ieee_exceptions and
iso_fortran_env. I also fixed a typo in a comment. Also, the use of the real
standare interface caused one of the error messages to go away, so I fixed
that.
Original-commit: flang-compiler/f18@
a8b310a9685d7e6502073ecb011c16aaa1e1d14b
Reviewed-on: https://github.com/flang-compiler/f18/pull/637
Peter Steinfeld [Thu, 8 Aug 2019 20:28:50 +0000 (13:28 -0700)]
[flang] Tests for DO loop semantics
These are tests for checks that are already implemented, but for which we
did not have tests.
Original-commit: flang-compiler/f18@
68f5acf7b1202162150162e1974fe43341a33eed
Reviewed-on: https://github.com/flang-compiler/f18/pull/637
Tree-same-pre-rewrite: false