platform/upstream/llvm.git
5 years ago[flang] Fix: catch subroutine symbols in ALLOCATE
Jean Perier [Wed, 22 May 2019 15:00:19 +0000 (08:00 -0700)]
[flang] Fix: catch subroutine symbols in ALLOCATE

Original-commit: flang-compiler/f18@99d4b3dcd6a34c571979ca520b10033ee9a0b973
Reviewed-on: https://github.com/flang-compiler/f18/pull/467

5 years ago[flang] Merge pull request flang-compiler/f18#466 from flang-compiler/pmk1
Peter Klausler [Tue, 21 May 2019 18:04:56 +0000 (11:04 -0700)]
[flang] Merge pull request flang-compiler/f18#466 from flang-compiler/pmk1

Fixes to problems in (mostly) expression semantics

Original-commit: flang-compiler/f18@c501ef36fadac0e289982b96231dc23a062b0280
Reviewed-on: https://github.com/flang-compiler/f18/pull/466

5 years ago[flang] Address review comments from Jean (thanks!)
peter klausler [Tue, 21 May 2019 17:24:30 +0000 (10:24 -0700)]
[flang] Address review comments from Jean (thanks!)

Original-commit: flang-compiler/f18@5183c6196e36fa361d1f18717d741c2fe36a31df
Reviewed-on: https://github.com/flang-compiler/f18/pull/466

5 years ago[flang] work in progress
peter klausler [Mon, 13 May 2019 16:33:18 +0000 (09:33 -0700)]
[flang] work in progress

checkpoint: changes build, tests all pass

many fixes, ready to test more

Further CLASS(*) support

More fixes for CLASS(*)

Hide data members of DynamicType

implement PRESENT() intrinsic

Original-commit: flang-compiler/f18@044ba12c20f77c130e3c468914ddc2d6c8652c6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/466
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#465 from flang-compiler/pmk-fix-tim
Peter Klausler [Wed, 15 May 2019 22:42:30 +0000 (15:42 -0700)]
[flang] Merge pull request flang-compiler/f18#465 from flang-compiler/pmk-fix-tim

Fix crash reported by Tim

Original-commit: flang-compiler/f18@6ad320265a54acafd724dc28f6a1e7a6a875246c
Reviewed-on: https://github.com/flang-compiler/f18/pull/465

5 years ago[flang] Fix crash reported by Tim
peter klausler [Wed, 15 May 2019 20:23:31 +0000 (13:23 -0700)]
[flang] Fix crash reported by Tim

Original-commit: flang-compiler/f18@7fe2d197ea572f61b89910c4f074768f7b3a390b
Reviewed-on: https://github.com/flang-compiler/f18/pull/465

5 years ago[flang] Merge pull request flang-compiler/f18#463 from flang-compiler/pmk-fix-brian
Peter Klausler [Wed, 15 May 2019 20:24:03 +0000 (13:24 -0700)]
[flang] Merge pull request flang-compiler/f18#463 from flang-compiler/pmk-fix-brian

Fix bug with comment clipping on compiler directives

Original-commit: flang-compiler/f18@9307806d7ab8942d61294c97362a2031d1c4b0c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/463

5 years ago[flang] Fix bug with comment clipping on compiler directives
peter klausler [Wed, 15 May 2019 19:35:36 +0000 (12:35 -0700)]
[flang] Fix bug with comment clipping on compiler directives

Original-commit: flang-compiler/f18@3f4375c57cbfd98fa1a507d571fb428e8ca96a32
Reviewed-on: https://github.com/flang-compiler/f18/pull/463

5 years ago[flang] Merge pull request flang-compiler/f18#460 from flang-compiler/pmk-fix-brian
Peter Klausler [Mon, 13 May 2019 16:30:53 +0000 (09:30 -0700)]
[flang] Merge pull request flang-compiler/f18#460 from flang-compiler/pmk-fix-brian

Strip comments from source and directive lines after macro replacement

Original-commit: flang-compiler/f18@ab5794470a7e8fbf2dde8ed724f0a05f9bf3abf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/460

5 years ago[flang] Strip comments from source and directive lines after macro replacement
peter klausler [Fri, 10 May 2019 23:04:10 +0000 (16:04 -0700)]
[flang] Strip comments from source and directive lines after macro replacement

Original-commit: flang-compiler/f18@ecf22e6698e82b36e5d709aa0362ac9f7591ea89
Reviewed-on: https://github.com/flang-compiler/f18/pull/460

5 years ago[flang] Merge pull request flang-compiler/f18#455 from flang-compiler/tsk4
Tim Keith [Thu, 9 May 2019 21:10:46 +0000 (14:10 -0700)]
[flang] Merge pull request flang-compiler/f18#455 from flang-compiler/tsk4

Change parse tree to allow DO loop over REAL

Original-commit: flang-compiler/f18@2771ee8dd8c69eadbaaab2b02e06f586b5f26af3
Reviewed-on: https://github.com/flang-compiler/f18/pull/455

5 years ago[flang] Update extensions doc for DO loop over REAL
Tim Keith [Thu, 9 May 2019 17:04:46 +0000 (10:04 -0700)]
[flang] Update extensions doc for DO loop over REAL

Original-commit: flang-compiler/f18@bc8ea466fcd129b895288b4c6c1ac81336e54dab
Reviewed-on: https://github.com/flang-compiler/f18/pull/455

5 years ago[flang] Address review comments
Tim Keith [Thu, 9 May 2019 17:00:13 +0000 (10:00 -0700)]
[flang] Address review comments

Use better names for template parameters of `LoopBounds`, and also
for the constructor arguments.

Use two overloadings of `loopBounds()` instead of `std::is_same_v<>`.

Original-commit: flang-compiler/f18@a2c0c75462caad57af40aa46a58131e946e21ce7
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
Tree-same-pre-rewrite: false

5 years ago[flang] Change parse tree to allow DO loop over REAL
Tim Keith [Thu, 9 May 2019 15:32:27 +0000 (08:32 -0700)]
[flang] Change parse tree to allow DO loop over REAL

It is a common extension to allow DO loops with REAL variable and
bounds. The parse tree currently parses those with the variable
as `scalar-int-variable-name` and the bounds as `scalar-int-expr`.
That causes the INTEGER constraint to be enforced automatically.

Change the grammar and parse tree to treat them as `scalar-variable-name`
and `scalar-expr`. This allows the name and expression to be REAL,
but we will have to verify that they aren't any other type (in a future
change).

To accomplish this, add a template parameter to `LoopBounds` for the type
of the variable name (always `Scalar<Name>` or `Scalar<Integer<Name>>`).
We sometimes need names for the instantiations of `LoopBounds` so add
type aliases like `LoopControl::Bounds` for each one.

Original-commit: flang-compiler/f18@d75aa039701186584d46f0126dcdc1186515a058
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#452 from flang-compiler/ps_do_c1121
psteinfeld [Thu, 9 May 2019 18:02:07 +0000 (11:02 -0700)]
[flang] Merge pull request flang-compiler/f18#452 from flang-compiler/ps_do_c1121

Added a test for C1121, DO scalar-mask-expr cannot reference IMPURE procedure

Original-commit: flang-compiler/f18@83842cc1b8e83fb2fc41911a410c2e5c335492ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/452

5 years ago[flang] Added a TODO to include the name of the IMPURE procedure in the error
Peter Steinfeld [Thu, 9 May 2019 17:54:58 +0000 (10:54 -0700)]
[flang] Added a TODO to include the name of the IMPURE procedure in the error
message for referencing in IMPURE procedure in the scalar-mask-expr of
a DO CONCURRENT.

Also removed a bogus comment from the test.

Both of these changes were in response to review comments.

Original-commit: flang-compiler/f18@4447d59b3982218db131c5ce9a78b8ddb77bfe68
Reviewed-on: https://github.com/flang-compiler/f18/pull/452

5 years ago[flang] Added a test for C1121 -- in a concurrent DO loop, the
Peter Steinfeld [Wed, 8 May 2019 20:17:36 +0000 (13:17 -0700)]
[flang] Added a test for C1121 -- in a concurrent DO loop, the
scalar-mask-expr cannot reference an IMPURE procedure.

Original-commit: flang-compiler/f18@0684c6ccc23213865d65e8b09c1fbf07436bdc00
Reviewed-on: https://github.com/flang-compiler/f18/pull/452
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#453 from flang-compiler/by-mp-parser-fix
Jinxin (Brian) Yang [Wed, 8 May 2019 23:00:00 +0000 (16:00 -0700)]
[flang] Merge pull request flang-compiler/f18#453 from flang-compiler/by-mp-parser-fix

OpenMP 4.5 grammar related minor fixes

Original-commit: flang-compiler/f18@2a1c37d251fe434a40a19bc9529ca831933cd855
Reviewed-on: https://github.com/flang-compiler/f18/pull/453

5 years ago[flang] OpenMP 4.5 grammar related minor fixes
Jinxin Yang [Wed, 8 May 2019 21:05:44 +0000 (14:05 -0700)]
[flang] OpenMP 4.5 grammar related minor fixes

1. typo and trailing spaces within OpenMP-4.5-grammar.txt

2. parse (openmp-grammar.h) and unparse(unparse.cc) for:

   SCHEDULE ([modifier [, modifier]:]kind[, chunk_size])
   Modifier ->  MONITONIC | NONMONOTONIC | SIMD

where ":" is optional except at least one modifier is present.

Original-commit: flang-compiler/f18@5cebae50390a1b22316ef2d86e87f2dabaaaa61f
Reviewed-on: https://github.com/flang-compiler/f18/pull/453

5 years ago[flang] Merge pull request flang-compiler/f18#451 from flang-compiler/pmk-fix-val-bug
Peter Klausler [Wed, 8 May 2019 19:19:56 +0000 (12:19 -0700)]
[flang] Merge pull request flang-compiler/f18#451 from flang-compiler/pmk-fix-val-bug

Allow use of (x?"a":"b") as a message argument

Original-commit: flang-compiler/f18@bbf5b816ec131eae384340ca650bada4d6001fb4
Reviewed-on: https://github.com/flang-compiler/f18/pull/451

5 years ago[flang] Allow use of (x?"a":"b") as a message argument
peter klausler [Wed, 8 May 2019 18:10:21 +0000 (11:10 -0700)]
[flang] Allow use of (x?"a":"b") as a message argument

Original-commit: flang-compiler/f18@c0d4e5545597fa744f53d2674935bc8de7793895
Reviewed-on: https://github.com/flang-compiler/f18/pull/451

5 years ago[flang] Merge pull request flang-compiler/f18#449 from flang-compiler/pmk-ps-bug
Peter Klausler [Wed, 8 May 2019 18:07:44 +0000 (11:07 -0700)]
[flang] Merge pull request flang-compiler/f18#449 from flang-compiler/pmk-ps-bug

Handle remaining cases in expression tree traversal

Original-commit: flang-compiler/f18@40cb0ada0f52ff352b09e88216a452c4faf11089
Reviewed-on: https://github.com/flang-compiler/f18/pull/449

5 years ago[flang] Add & use mutators for Substring, Triplet, CoarrayRef
peter klausler [Wed, 8 May 2019 17:22:56 +0000 (10:22 -0700)]
[flang] Add & use mutators for Substring, Triplet, CoarrayRef

Original-commit: flang-compiler/f18@cc2de361fa5d2ee41a91e256e33003baa892d4d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/449

5 years ago[flang] Fix warning
peter klausler [Wed, 8 May 2019 01:21:55 +0000 (18:21 -0700)]
[flang] Fix warning

Original-commit: flang-compiler/f18@4fcf88901c012cedac99869dc4ff689e6ab35803
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false

5 years ago[flang] Address review comment
peter klausler [Wed, 8 May 2019 01:20:45 +0000 (18:20 -0700)]
[flang] Address review comment

Original-commit: flang-compiler/f18@5d20cd48b6bf3afc4c6fcea69faf50e40604f6a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false

5 years ago[flang] dodge clang build problem with constexpr
peter klausler [Wed, 8 May 2019 00:05:14 +0000 (17:05 -0700)]
[flang] dodge clang build problem with constexpr

Original-commit: flang-compiler/f18@83995a5a981dc25babd87ebbc816f026f3033b2e
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false

5 years ago[flang] Remove debugging
peter klausler [Tue, 7 May 2019 23:26:47 +0000 (16:26 -0700)]
[flang] Remove debugging

Original-commit: flang-compiler/f18@1db626f8385d24b0c9fc4d97af6e727a2516ccfd
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false

5 years ago[flang] Fix folding of substring
peter klausler [Tue, 7 May 2019 23:24:50 +0000 (16:24 -0700)]
[flang] Fix folding of substring

Original-commit: flang-compiler/f18@62dc5e0c93d9f051ef936ee7a281240fe3657b35
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false

5 years ago[flang] Handle remaining cases in expression traversal
peter klausler [Tue, 7 May 2019 23:19:45 +0000 (16:19 -0700)]
[flang] Handle remaining cases in expression traversal

Original-commit: flang-compiler/f18@5cb0de58d4cba1bae3f3e67b850dfcbc0ac586fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#450 from flang-compiler/by-pgf90-mp
Brian [Wed, 8 May 2019 17:24:57 +0000 (10:24 -0700)]
[flang] Merge pull request flang-compiler/f18#450 from flang-compiler/by-pgf90-mp

Add -mp option for pgf90 in the presence of -fopenmp

Original-commit: flang-compiler/f18@e07b20a7993f03da25ac104b96b7c2f4f5faec5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/450

5 years ago[flang] Add -mp option for pgf90 in the presence of -fopenmp
Jinxin Yang [Wed, 8 May 2019 15:43:20 +0000 (08:43 -0700)]
[flang] Add -mp option for pgf90 in the presence of -fopenmp

Original-commit: flang-compiler/f18@a9d7287420c4d48ab0dfbc2942eeb3c454c41648
Reviewed-on: https://github.com/flang-compiler/f18/pull/450

5 years ago[flang] Merge pull request flang-compiler/f18#444 from flang-compiler/pmk-msg-format
Peter Klausler [Tue, 7 May 2019 19:15:49 +0000 (12:15 -0700)]
[flang] Merge pull request flang-compiler/f18#444 from flang-compiler/pmk-msg-format

Replace formatting of CharBlock & string

Original-commit: flang-compiler/f18@359bedbefdea13c84182c1ba1691249fedaabfae
Reviewed-on: https://github.com/flang-compiler/f18/pull/444

5 years ago[flang] Remove support for Names in messages for now.
peter klausler [Tue, 7 May 2019 17:04:21 +0000 (10:04 -0700)]
[flang] Remove support for Names in messages for now.

Original-commit: flang-compiler/f18@15d38c7059352cb4d6d8df28a35cbde3b0fe92c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/444

5 years ago[flang] Merge with recent changes
peter klausler [Tue, 7 May 2019 16:22:53 +0000 (09:22 -0700)]
[flang] Merge with recent changes

Original-commit: flang-compiler/f18@56a72cbbd66d0aa0b3e9a1b0e2f3a71f467d62f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/444
Tree-same-pre-rewrite: false

5 years ago[flang] Replace formatting of CharBlock & string
peter klausler [Mon, 6 May 2019 16:33:45 +0000 (09:33 -0700)]
[flang] Replace formatting of CharBlock & string

Preserve generated strings until consumed by formatting.

bugfix from premature push

Address review comments

Last fix(?)

Use %s formatting for CharBlocks and strings

Use new formatting and fix usage of std::forward<>()

Use forward_list rather than vector to save strings

Original-commit: flang-compiler/f18@8ea478420fd21a26a77c6b4e05c73529a566f4a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/444
Tree-same-pre-rewrite: false

5 years ago[flang] Change a user error to an internal error in ALLOCATE semantic check
jeanPerier [Tue, 7 May 2019 15:44:23 +0000 (08:44 -0700)]
[flang] Change a user error to an internal error in ALLOCATE semantic check

Merge pull request flang-compiler/f18#448 from flang-compiler/jpr-check-allocate

Original-commit: flang-compiler/f18@66e766ac9ae2b062c3b1d8aaee63c42be2ffacf2

5 years ago[flang] Change a user error to an internal error in ALLOCATE semantic check
Jean Perier [Tue, 7 May 2019 15:28:24 +0000 (08:28 -0700)]
[flang] Change a user error to an internal error in ALLOCATE semantic check

Original-commit: flang-compiler/f18@d9a9b59634761b328e1540ba9ef2b04c19318fd8

5 years ago[flang] Merge pull request flang-compiler/f18#443 from flang-compiler/tsk4b
Tim Keith [Tue, 7 May 2019 14:35:58 +0000 (07:35 -0700)]
[flang] Merge pull request flang-compiler/f18#443 from flang-compiler/tsk4b

Process specification parts before execution parts

Original-commit: flang-compiler/f18@c8d3a77c028f6d48088ee1afd419d6dc01544b54
Reviewed-on: https://github.com/flang-compiler/f18/pull/443

5 years ago[flang] Re-enable test resolve51.f90
Tim Keith [Tue, 7 May 2019 14:35:10 +0000 (07:35 -0700)]
[flang] Re-enable test resolve51.f90

Original-commit: flang-compiler/f18@595e45fd3451079a5c1cb02028d7cfb84c5ae945
Reviewed-on: https://github.com/flang-compiler/f18/pull/443

5 years ago[flang] Move ProgramTree to its own file
Tim Keith [Mon, 6 May 2019 17:12:27 +0000 (10:12 -0700)]
[flang] Move ProgramTree to its own file

Original-commit: flang-compiler/f18@06913c38ca86b46956040eb45e01fe7b0464be98
Reviewed-on: https://github.com/flang-compiler/f18/pull/443
Tree-same-pre-rewrite: false

5 years ago[flang] Process specification parts before execution parts
Tim Keith [Mon, 6 May 2019 14:26:43 +0000 (07:26 -0700)]
[flang] Process specification parts before execution parts

Change the order in which names are resolved. Before resolving names
in the execution part of a subprogram we need to know the interface
of contained subprograms. This is because the type of some construct
entities can depend on the return type of contained functions, e.g.
```
  associate(x => f())
  end associate
contains
  function f()...
```

To do this, we now build a tree rooted at each program unit with
child nodes corresponding to subprograms contained in the parent.
This provides flexibility in choosing an order to resolve names.
The current implementation processes all specification parts before
any execution parts. This ensures contained subprogram interfaces
are know before analyzing constructs like ASSOCIATE.

Resolving a specification part involves first adding
`SubprogramNameDetails` symbols for each contained subprogram, then
processing the statement that introduces the program unit (`ModuleStmt`,
`SubroutineStmt`, etc.), then visiting all of the statements in the
specification part.

If it proves necessary, we can add a phase to do implicit declarations
in the execution part before processing the specification part of
contained subprograms.

Original-commit: flang-compiler/f18@20e803fd9289759a4e421794bdb9b401ee709da2
Reviewed-on: https://github.com/flang-compiler/f18/pull/443
Tree-same-pre-rewrite: false

5 years ago[flang] Add DIE macro
Tim Keith [Fri, 3 May 2019 15:02:31 +0000 (08:02 -0700)]
[flang] Add DIE macro

`DIE()` is like `common::die()` but with the source location appended,
as in `CHECK()`.

Original-commit: flang-compiler/f18@ed586c3f3837afc396499e9348beffae551ae9eb
Reviewed-on: https://github.com/flang-compiler/f18/pull/443
Tree-same-pre-rewrite: false

5 years ago[flang] Change how Scopes are mapped to ImplicitRules
Tim Keith [Thu, 2 May 2019 18:19:01 +0000 (11:19 -0700)]
[flang] Change how Scopes are mapped to ImplicitRules

Previously we maintained a stack of ImplicitRules in parallel with
the Scope stack. Change to maintaining a mapping from Scope to
ImplicitRules.

This makes things simpler in some cases: Block scopes don't have their
own implicit rules. And submodule scopes aren't just pushed and popped.
This will also help with future changes to the order in which scopes
are processed.

Original-commit: flang-compiler/f18@443da503529a57925bd11a00db4be0a8105b6e5e
Reviewed-on: https://github.com/flang-compiler/f18/pull/443
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#445 from flang-compiler/pmk-fixes
Peter Klausler [Mon, 6 May 2019 18:44:36 +0000 (11:44 -0700)]
[flang] Merge pull request flang-compiler/f18#445 from flang-compiler/pmk-fixes

Fix or disable broken tests.

Original-commit: flang-compiler/f18@1d384b549ac37e7ed5c6cfe30c4ac67023372378
Reviewed-on: https://github.com/flang-compiler/f18/pull/445

5 years ago[flang] Fix or disable broken tests.
peter klausler [Mon, 6 May 2019 18:33:33 +0000 (11:33 -0700)]
[flang] Fix or disable broken tests.

Original-commit: flang-compiler/f18@a54396e92e3e23d334c52daaffab217ce70d48e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/445

5 years ago[flang] Merge pull request flang-compiler/f18#442 from flang-compiler/pmk-struct...
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

5 years ago[flang] Tweak error message grammar
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

5 years ago[flang] Remove OwningPointer and ForwardReference
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

5 years ago[flang] Allocate semantic checks (second and last part)
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

5 years ago[flang] Address comments
Jean Perier [Fri, 3 May 2019 08:31:48 +0000 (01:31 -0700)]
[flang] Address comments

Original-commit: flang-compiler/f18@2a6473ce6af3d409fda024915c719ee88db40a78

5 years ago[flang] Allocate semantic checks (second part)
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

5 years ago[flang] Merge pull request flang-compiler/f18#441 from flang-compiler/pmk-message...
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

5 years ago[flang] Prevent unhandled special formatting
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

5 years ago[flang] Support %zu and %ju before special codes; add comments
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

5 years ago[flang] Add comments
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

5 years ago[flang] Support std::string and CharBlock in formatted messages
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

5 years ago[flang] Merge pull request flang-compiler/f18#440 from flang-compiler/pmk1
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

5 years ago[flang] Changes from review
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

5 years ago[flang] Merge pull request flang-compiler/f18#439 from flang-compiler/pmk1
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

5 years ago[flang] lib/evaluate work for structure constructors
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

5 years ago[flang] Merge pull request flang-compiler/f18#438 from flang-compiler/pmk-fix-pp...
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

5 years ago[flang] Fix f90_correct test failure
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

5 years ago[flang] Fix bug flang-compiler/f18#437, func-like macro call with no arguments
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

5 years ago[flang] Merge pull request flang-compiler/f18#434 from flang-compiler/ps
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

5 years ago[flang] Changed the test for unmatched DO loop names to use test_errors.sh
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

5 years ago[flang] Tests for C1131, making sure that names of DO loops match between the loop...
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

5 years ago[flang] reformat Fortran.h (flang-compiler/f18#435)
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

5 years ago[flang] Clause 12 semantics -- Check all constraints not otherwise checked (flang...
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

5 years ago[flang] Merge pull request flang-compiler/f18#433 from flang-compiler/tsk4
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

5 years ago[flang] Fix source positions during parse tree rewriting
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

5 years ago[flang] Optionally dump all source members of parse tree
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

5 years ago[flang] Walk source member of Call and Designator
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

5 years ago[flang] Merge pull request flang-compiler/f18#429 from flang-compiler/tsk1
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

5 years ago[flang] Move HasError, SetError to SemanticsContext
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

5 years ago[flang] Continue semantic checking after name resolution error
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

5 years ago[flang] Merge pull request flang-compiler/f18#430 from flang-compiler/tsk2
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

5 years ago[flang] Fix test
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

5 years ago[flang] Bug fix: resolve ComponentArraySpec
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

5 years ago[flang] revert last pushes
Eric Schweitz [Wed, 24 Apr 2019 18:41:40 +0000 (11:41 -0700)]
[flang] revert last pushes

Original-commit: flang-compiler/f18@39335746a99c5291b82932f119bc2d25d251f022

5 years ago[flang] fix merge issues
Eric Schweitz [Tue, 9 Apr 2019 18:13:48 +0000 (11:13 -0700)]
[flang] fix merge issues

Original-commit: flang-compiler/f18@20a6d8a159d03813392b93255a72a334d6cde15b

5 years ago[flang] clang-format
Eric Schweitz [Tue, 9 Apr 2019 16:35:52 +0000 (09:35 -0700)]
[flang] clang-format

Original-commit: flang-compiler/f18@faa7ccf90584f0cd18e9e02e009c0734ec16c22b

5 years ago[flang] Some initial bridge code
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

5 years ago[flang] start splitting up afforestation so it isn't monolithic
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

5 years ago[flang] fix interface
Eric Schweitz [Tue, 23 Apr 2019 21:40:04 +0000 (14:40 -0700)]
[flang] fix interface

Original-commit: flang-compiler/f18@668fd8338dea9ce214451d21f02051935aa5e889

5 years ago[flang] First batch of semantic checks for allocate
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

5 years ago[flang] fix comment layout
Jean Perier [Tue, 23 Apr 2019 13:06:33 +0000 (06:06 -0700)]
[flang] fix comment layout

Original-commit: flang-compiler/f18@ad874f01523b90a58b7825ed02e6c3bea6cd38c8

5 years ago[flang] Address review comments
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

5 years ago[flang] Fix allocate in deallocate01.f90 test
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

5 years ago[flang] First batch of semantics checks for allocate
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

5 years ago[flang] Merge pull request flang-compiler/f18#423 from flang-compiler/pmk-packs
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

5 years ago[flang] Use parameter packs to simplify parser combinators. Work around g++ bug...
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

5 years ago[flang] Merge pull request flang-compiler/f18#424 from flang-compiler/tsk-expr
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

5 years ago[flang] Change ExprRef to return reference
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

5 years ago[flang] Distinguish between unanalyzed and error expressions
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

5 years ago[flang] Merge pull request flang-compiler/f18#426 from flang-compiler/pmk-425
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

5 years ago[flang] Fix flang-compiler/f18#425, build fail with libc++
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

5 years ago[flang] Merge pull request flang-compiler/f18#421 from flang-compiler/pmk3
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

5 years ago[flang] Add some utility functions to semantics/tools
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

5 years ago[flang] Merge pull request flang-compiler/f18#422 from flang-compiler/tsk-expr
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

5 years ago[flang] Share code for analyzing Expr and Variable
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