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
Jinxin (Brian) Yang [Fri, 9 Aug 2019 22:11:20 +0000 (15:11 -0700)]
[flang] [OpenMP] parse tree changes for `OpenMPBlockConstruct` (flang-compiler/f18#632)
* [OpenMP] parse tree changes for `OpenMPBlockConstruct`
1. merge `Workshare` and `Single` into `OpenMPBlockConstruct` because
they both accept structured-block and syntax is similar to other block
directives.
2. `OpenMPBlockConstruct` changes to structure like `{Begin, Block, End}`,
where `Begin` and `End` are tuple of `{Directive, ClauseList}`.
3. Updated the check-omp-structure.* for necessary parts. Added all the END
directive enumeration types that may have clauses.
More tests will be added during Semantics.
* [OpenMP] Update on Tim's suggestion
1. Fix unspecified enumeration for `OmpDirective` in the `OmpContext`.
This is through getting rid of `PushContext(source)` function to
make sure whenever it is about to push a NEW context, directive
source location and enumeration are available. To do that, I moved
around all the switches for directive into high level `Construct`'s
`Enter` node. Besides fixing the issue, the side benefit is that
whenever we call `GetContext().directive`, we are sure that the
`directive` here was set already.
2. When `Enter` the `OmpEndBlockDirective` node, partial context
information, such as directive source location or legal clause lists,
needs to be reset. The new directive source location should be
`OmpEndBlockDirective`'s `source`. The enumeration `directive`
should not be reset for the END directives that do not accept
clauses because nothing needs to be checked (for example any clause
that is on `END PARALLEL` is illegal).
Original-commit: flang-compiler/f18@
e5bd6b7ba0fbe9006f3e431260428b194f2d2616
Reviewed-on: https://github.com/flang-compiler/f18/pull/632
Peter Klausler [Fri, 9 Aug 2019 19:15:27 +0000 (12:15 -0700)]
[flang] Merge pull request flang-compiler/f18#638 from flang-compiler/pmk-forward
Handle forward references to procedures and interfaces
Original-commit: flang-compiler/f18@
c2ce89030b0f2cc4da77d2da7b27bd5b75b9a572
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
peter klausler [Fri, 9 Aug 2019 16:38:21 +0000 (09:38 -0700)]
[flang] address comments
Original-commit: flang-compiler/f18@
2bf995562cd86f61be7013e50e38c1aa5edc39eb
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
peter klausler [Thu, 8 Aug 2019 22:15:01 +0000 (15:15 -0700)]
[flang] Add test for forward references in pointer initializers
Original-commit: flang-compiler/f18@
9e01c102a1e14721bc10149f9902d41edfc96b77
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Thu, 8 Aug 2019 22:06:51 +0000 (15:06 -0700)]
[flang] More fixes; tests now all pass (with updates to some)
Original-commit: flang-compiler/f18@
236ff3a3db90bec3c7f859f18ce31bd38491347f
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Thu, 8 Aug 2019 17:50:23 +0000 (10:50 -0700)]
[flang] rebase
Original-commit: flang-compiler/f18@
a2086f040602473917846b027b923fcd141bd193
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Thu, 8 Aug 2019 17:13:33 +0000 (10:13 -0700)]
[flang] prep for review
Original-commit: flang-compiler/f18@
41f11f4fa0ddd91ffff003451e29bf6fff8c83b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Thu, 8 Aug 2019 00:10:43 +0000 (17:10 -0700)]
[flang] Proper PDT handling
Original-commit: flang-compiler/f18@
32256daa15d663cd6b24bccd15727cd1e4ddefe6
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Wed, 7 Aug 2019 21:45:44 +0000 (14:45 -0700)]
[flang] Restore symbol to ProcBindingDetails
Original-commit: flang-compiler/f18@
5dc1c91156d58ebd4f2e1ab720b01236976eb0a9
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Tue, 6 Aug 2019 18:49:47 +0000 (11:49 -0700)]
[flang] Save proc pointer inits in symbol table; add IsSaved() predicate to tools
Original-commit: flang-compiler/f18@
23c6be91681b04cad4981281301e450a16ae5b62
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Tue, 6 Aug 2019 17:22:10 +0000 (10:22 -0700)]
[flang] Checkpoint work
Original-commit: flang-compiler/f18@
b8f614c3c41815410acfc93989885d6eaea46bd8
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
peter klausler [Mon, 5 Aug 2019 23:11:59 +0000 (16:11 -0700)]
[flang] Deferred processing of pointer initializers (incomplete)
Original-commit: flang-compiler/f18@
2913b01c51ec3f1b3739c109aca9c41970b28d6c
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Fri, 9 Aug 2019 16:39:55 +0000 (09:39 -0700)]
[flang] [OpenMP] parse tree changes for ATOMIC constructs (flang-compiler/f18#636)
1. make the parse tree nodes more conform with OpenMP spec
2. isolate the memory related clauses to make the parse tree nodes
extendable for OpenMP 5.0
3. source provenance is saved for each atomic-clause (read, write, update,
and capture); for atomic-clause that is not present, source location
is saved for "ATOMIC" directive name itself
More tests will be added during Semantics.
Original-commit: flang-compiler/f18@
8e2db2f868f9dce705aa0a504e1c9ac1af8fe08f
Reviewed-on: https://github.com/flang-compiler/f18/pull/636
Tim Keith [Fri, 9 Aug 2019 13:48:16 +0000 (06:48 -0700)]
[flang] Merge pull request flang-compiler/f18#640 from flang-compiler/tsk-issue587
Fix bug with generic and specific having same name
Original-commit: flang-compiler/f18@
e8c8c0357bc428838b937912747e84b596ca4f9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/640
Tim Keith [Thu, 8 Aug 2019 23:52:36 +0000 (16:52 -0700)]
[flang] Fix bug with generic and specific having same name
If a generic interface had a specific procedure with the same name that
is specified by an interface body, it was not handled correctly.
We were replacing the generic symbol with the symbol for the specific
procedure. Instead, leave the generic symbol in the scope and just
insert the new symbol for the specific into the generic.
Also, don't do distinguishability checks when one of the specific
procedures already has an error.
Fixes flang-compiler/f18#587.
Original-commit: flang-compiler/f18@
2e905656758d7214635fb96a612760405b368b09
Reviewed-on: https://github.com/flang-compiler/f18/pull/640
Tim Keith [Fri, 9 Aug 2019 00:10:16 +0000 (17:10 -0700)]
[flang] Merge pull request flang-compiler/f18#639 from flang-compiler/tsk-shared
Fix problems building with shared libraries on Linux
Original-commit: flang-compiler/f18@
0e3ed603c8d6ca611e5ae71cf52da72d351e81fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/639
Tim Keith [Thu, 8 Aug 2019 23:23:53 +0000 (16:23 -0700)]
[flang] Fix problems building with shared libraries on Linux
Building with gcc 8 or 9 with shared libraries had linking
problems in test/evaluate. Fix those by adding FortranSemantics
to the library dependencies.
Original-commit: flang-compiler/f18@
009b9ab171b4a9d9a3b7ca79f1d0c0b5d0ee7a8c
Reviewed-on: https://github.com/flang-compiler/f18/pull/639
jeanPerier [Thu, 8 Aug 2019 12:48:20 +0000 (05:48 -0700)]
[flang] Merge pull request flang-compiler/f18#631 from flang-compiler/jpr-fix-589
Prevent result symbol to be converted into function when they are called
Original-commit: flang-compiler/f18@
464310a1e3b8cc222b0069c213de01c4c4561eaf
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
Jean Perier [Thu, 8 Aug 2019 12:30:21 +0000 (05:30 -0700)]
[flang] Fix reabsing conflict issue
Remove duplicate `IsFunctionResultWithSameNameAsFunction` declarartion.
Original-commit: flang-compiler/f18@
d88597ca7213ed63660a6633a0c88021b9d35949
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
Jean Perier [Thu, 8 Aug 2019 10:46:14 +0000 (03:46 -0700)]
[flang] Answer PR 631 comments:
- Create a function `IsFunctionResult(const Symbol &)` in
lib/semantics/tools.h.
- style edit in weird var definition style.
Original-commit: flang-compiler/f18@
15e3f87b40345765ac500e5f8c1412c31d4e2658
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
Tree-same-pre-rewrite: false
Jean Perier [Wed, 7 Aug 2019 10:51:13 +0000 (03:51 -0700)]
[flang] Prevent result symbol to be converted into function when they are called.
+ Fix issue 589.
+ Catch empty subscript list in array reference
In name resolution, when skimming through the execution statement of a
function, calls to the result symbol should not trigger the conversion
of this symbol to a function symbol. The result is a data object and
cannot be called unless it was explictly declared to be a procedure
pointer.
Notably, recursive function calls cannot be made if RESULT was not used.
The symbol is prevented from being transformed into a function
symbol by transforming it into an object before skimming through the
executable statement. This is done after processing all the
specifications so that if the result actually is a procedure pointer,
the call to `ConvertToObjectEntity` introduced by this commit will
not convert it to an object by mistake.
This commit also introduce a check when fixing misparsed function
reference into array reference to verify the array reference has
array subscripts. Currently this went uncaught. It is not possible
to complain later in expressions because the subscript list of
expression might be empty for unrelated error recovery reasons
(e.g. if an entity of the wrong type appeared as susbcript).
Add related tests.
Original-commit: flang-compiler/f18@
2fd8b65f58aadc567dd23d64e4654304a42f6176
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
Tree-same-pre-rewrite: false
jeanPerier [Thu, 8 Aug 2019 08:55:50 +0000 (01:55 -0700)]
[flang] Merge pull request flang-compiler/f18#607 from flang-compiler/jpr-fix-594
Fix issue 594 and add a derived type component visitor framework
Original-commit: flang-compiler/f18@
009db27bfaca2a84b0795c0d977c68cd8b57ce88
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Jean Perier [Wed, 31 Jul 2019 17:30:42 +0000 (10:30 -0700)]
[flang] copyright update
Original-commit: flang-compiler/f18@
e724438925f1cd5c28fe1fcf7ba93b1b9773f9e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Jean Perier [Wed, 31 Jul 2019 15:56:25 +0000 (08:56 -0700)]
[flang] use newly added DEREF in component iterator
Original-commit: flang-compiler/f18@
2185f2000967b7d4b51bf2eba663ba3dcea43a4b
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
Jean Perier [Wed, 31 Jul 2019 14:19:22 +0000 (07:19 -0700)]
[flang] Checkpoint: derived type component iterators
Original-commit: flang-compiler/f18@
72d209bb52d28aedc8335c8175a5ffb5bce161fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
Jean Perier [Fri, 26 Jul 2019 15:11:59 +0000 (08:11 -0700)]
[flang] Improve error messages about component types in allocate checks
Use component visitor framework to attach more information reagrding
where is the ultimate/potential component that is forbidden.
Also remove unused functions.
Original-commit: flang-compiler/f18@
4619c5860a43b86f149698c495769bdff2d63557
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
Jean Perier [Fri, 26 Jul 2019 13:39:26 +0000 (06:39 -0700)]
[flang] Do not die on typeless source expression in allocate.
While fixing 594, it appears the CHECK in allocate for non null
expression type pointer was too harsh as it could be a user error.
e.g: a boz used as source.
Original-commit: flang-compiler/f18@
cbacdeaa0eb8077810db85d5b4469f797d524900
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
Jean Perier [Fri, 26 Jul 2019 13:33:48 +0000 (06:33 -0700)]
[flang] Add a derived type component visitor framework
After fixing 594, it appears there were issues in
FindUltimateComponent that was considering type bound
procedure as components.
This commit fixes and beef-up the component visitation by making a visitor
class for it. The main advantage of making it an class vs functions is that
it is possible to get the component chain to the result component for better
feedback for the user.
The framework allow a single place to define/handle what ultimate, direct and
potential components are.
Original-commit: flang-compiler/f18@
d84821a1d63f35904a004007f3645d689d8c3a4f
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
Jean Perier [Fri, 26 Jul 2019 13:31:44 +0000 (06:31 -0700)]
[flang] Fix issue 594
Add ProcBindingDetails to handling GetType.
Also add HostAssocDetails to be consitent with UseDetails handling
in this GetType.
Original-commit: flang-compiler/f18@
b498aab15fa3561818474965ea957a49ba1ae544
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
Steve Scalpone [Wed, 7 Aug 2019 18:52:11 +0000 (11:52 -0700)]
[flang] Merge pull request flang-compiler/f18#584 from CarolineConcatto/block_construct_patch
Adding semantic checks for Block Construct
Original-commit: flang-compiler/f18@
47781549a3b042bd609f6cb5b1d8cdbd7983037d
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Caroline Concatto [Wed, 7 Aug 2019 07:47:04 +0000 (08:47 +0100)]
[flang] Removing TODO comments as they are implemented by this patch
Original-commit: flang-compiler/f18@
885eb92b4f8ce07fc39af3655f6c04b74a10a9fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Caroline Concatto [Tue, 6 Aug 2019 08:26:40 +0000 (09:26 +0100)]
[flang] Removing two sentence error
Original-commit: flang-compiler/f18@
fd5aafc5af14e41cfbae9454394d4eb6b39e2e91
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
Caroline Concatto [Tue, 23 Jul 2019 09:29:53 +0000 (10:29 +0100)]
[flang] Changes in SaveStmt message for Common Block name specifier
Original-commit: flang-compiler/f18@
2e63705f5c0e5bab5262495b0164ab90dc19ad47
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
Caroline Concatto [Mon, 22 Jul 2019 14:35:51 +0000 (15:35 +0100)]
[flang] Changes requested by the comunity
Original-commit: flang-compiler/f18@
309dd0fdfe4195d4624f9b1e55d3f5fe57e1ac9e
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
Caroline Concatto [Wed, 17 Jul 2019 10:24:42 +0000 (11:24 +0100)]
[flang] Adding semantic checks for Block Construct
Original-commit: flang-compiler/f18@
e626f431d46144b0003ccb3d0c9fe80c29cfa499
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
Tim Keith [Wed, 7 Aug 2019 18:18:50 +0000 (11:18 -0700)]
[flang] Merge pull request flang-compiler/f18#630 from flang-compiler/tsk-array-spec
Perform more checks on array-specs
Original-commit: flang-compiler/f18@
14a38209a9b08a65e919848207eb45421a168ef2
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tim Keith [Tue, 6 Aug 2019 21:14:33 +0000 (14:14 -0700)]
[flang] Fix errors in tests and predefined modules
There were many places in tests and predefined modules that had
incorrect code that we weren't detecting until now.
Most of the problems were deferred-shape arrays that should have
been implied-shape. For example:
`real, parameter :: a(:) = [1.0, 2.0]`
should have `(*)` rather than `(:)`.
There were also a few places with deferred-shape arrays that were
not allocatable/pointer or explicit-shape ones that were.
Original-commit: flang-compiler/f18@
0a959ce1d81dd2e54b72886db699b12c7ad59d88
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tim Keith [Tue, 6 Aug 2019 20:55:56 +0000 (13:55 -0700)]
[flang] Improve failure message from test_modfile.sh
When test_modfile.sh fails a test, show the path to the source file
so it is easier to find the problems when grepping the log.
Original-commit: flang-compiler/f18@
4a0d0d19a0010b9342425a9b7f1db3ce4dada661
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
Tim Keith [Tue, 6 Aug 2019 20:48:13 +0000 (13:48 -0700)]
[flang] Perform more checks on array-specs
There are many constraints on what kind of array-specs can appear
in what contexts. Add `CheckArraySpec()` to perform most of them.
When the check fails, don't set the shape of the symbol being
declared and instead set the Error flag so we can avoid cascading
errors.
Fixes flang-compiler/f18#609.
Original-commit: flang-compiler/f18@
f159d97f1f1e02b4d66e410b0f5a587f3c8fc51a
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
Tim Keith [Tue, 6 Aug 2019 20:36:18 +0000 (13:36 -0700)]
[flang] Change `ArraySpec` from a type alias to a class
This allows it to have member functions `Rank()`, `IsExplicitShape()`,
`IsAssumedShape()`, etc. Make use of those new functions and remove
`isExplicit()` and `isDeferred()` from `ShapeSpec` as they are no
longer needed.
Original-commit: flang-compiler/f18@
7ef7ad63594db9c41a0889d2ad419dbdf841cb6f
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
Tim Keith [Tue, 6 Aug 2019 17:20:16 +0000 (10:20 -0700)]
[flang] Change parsing of ambiguous array-spec
An array-spec like `(:,:)` (with one or more colons) is either a
deferred-shape-spec-list or an assumed-shape-spec-list and they
can only be distinguished by context that the parser doesn't have.
We were parsing these as assumed-shape-spec-list but they are easier
to deal with if we parse them as deferred-shape-spec-list because
anything that is the latter is also one of the former.
Original-commit: flang-compiler/f18@
78c3f3b96f78e45b1b9966b331d8cda691fa39bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
Tim Keith [Tue, 6 Aug 2019 17:08:51 +0000 (10:08 -0700)]
[flang] Add operator<< for parser::CharBlock
Original-commit: flang-compiler/f18@
439326dc968ffe097cbc6e156559860ec225af41
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
Peter Klausler [Wed, 7 Aug 2019 17:41:39 +0000 (10:41 -0700)]
[flang] Merge pull request flang-compiler/f18#633 from flang-compiler/pmk-warnings
Dodge two bogus warnings from g++ 8.1
Original-commit: flang-compiler/f18@
2aa98a9d4d868ee18b43b2bcc70fd8831753c4fe
Reviewed-on: https://github.com/flang-compiler/f18/pull/633
peter klausler [Wed, 7 Aug 2019 16:18:20 +0000 (09:18 -0700)]
[flang] Dodge two bogus warnings from g++ 8.1
Original-commit: flang-compiler/f18@
aa19aeb92aedb02310a081f794c7a2046e801e2d
Reviewed-on: https://github.com/flang-compiler/f18/pull/633
jeanPerier [Wed, 7 Aug 2019 10:39:52 +0000 (03:39 -0700)]
[flang] Merge pull request flang-compiler/f18#615 from flang-compiler/jpr-fix-581
Fix issue 581: extended derived type kind parameter comparison
Original-commit: flang-compiler/f18@
4670ae020b45848380fe0150b48a45b46aab0402
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Jean Perier [Tue, 6 Aug 2019 11:40:43 +0000 (04:40 -0700)]
[flang] Answer comments
- make `TypaParamAttr` a `ParamValue` argument. Modify
`GetParamValue` to also take this as an argument.
- remove `GetLenParamValue` that is now useless and
modify constructor/`GetParamValue` calls
- get it the `TypeParamAttr` right from the begining
when visiting `parser::DerivedTypeSpec` in resolve-names.cc.
It was set to `Kind` by default and it was hard to ensure the
attribute would not be checked until set properly.
Original-commit: flang-compiler/f18@
bcc300e7141db6f692579e1327557c9831b9c85a
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Jean Perier [Fri, 2 Aug 2019 13:38:40 +0000 (06:38 -0700)]
[flang] Fix ParamValue attribute (kind/len) of implicit type parameters
While testing fix for issue 581 it appeared that 'ParamValue`
implicit len parameters had incorrect attribute kind.
This commit:
+ Set correct attribute when creating `ParamValue` for implicit
type parameter.
+ Also set the correct attribute foe charachter lenght `ParamValue`
though it is currently not used anywhere.
+ Change some std::int64_t to common::ConstantSubscript on the way.
Original-commit: flang-compiler/f18@
57a344b25607903638be6df47155bfe5515fff3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Tree-same-pre-rewrite: false
Jean Perier [Fri, 2 Aug 2019 13:32:35 +0000 (06:32 -0700)]
[flang] Fix extended derived type kind compatibility check
`HaveCompatibleKindParameters` was not considering the kind
parameters of the parent types leading to false answers.
This change fixes this by directly looking into the map of `ParamValue`
of the `DeclTypeSpec` instead of going through the symbols of the derived
type scope. This map contains all the parent and implicit type parameters.
Original-commit: flang-compiler/f18@
cd5b976fc96ec695d46f23910080cbcaa5431a5d
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Tue, 6 Aug 2019 18:59:40 +0000 (11:59 -0700)]
[flang] [OpenMP] parse tree changes for standalone directives (flang-compiler/f18#627)
* [OpenMP] parse tree changes for standalone directives
1. Put all standalone directives except FLUSH, CANCEL, and CANCELLATION POINT
into one `OpenMPSimpleStandaloneConstruct` (for no-clause directive,
validity checks will be deferred to Semantics). A top-level class will
include all the standalone directive nodes. This simplies the logic a lot.
2. All the standalone directives now have their own source provenance for
directive name itself.
3. Change check-omp-structure.* to avoid assertions
4. Add basic tests for standalone directives, more will be added during
the clause validity checks in Semantics
* Resolve !$OMP ORDERED ambiguity by attempting block construct first - Peter
Original-commit: flang-compiler/f18@
a77aa7ed84880927dea3e2b1bb6433350f99f1ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/627
psteinfeld [Tue, 6 Aug 2019 17:20:22 +0000 (10:20 -0700)]
[flang] Merge pull request flang-compiler/f18#612 from flang-compiler/ps-c1130
Changes to enforce constraint C1130
Original-commit: flang-compiler/f18@
88af7ce563eb1bff0f5ed32ea3f2fb10feea66d0
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
Peter Steinfeld [Mon, 5 Aug 2019 20:36:01 +0000 (13:36 -0700)]
[flang] Responses to review comments.
- dosemantics05.f90: Added tests for ASSOCIATE, BLOCK and SELECT TYPE statements and changed the error messages.
- check-do.cc: Changed things so that FindScope() is only called once when DoConcurrentVariableEnforce is instantiated. I changed the error message. I changed the type and name of CS to be an std::set and be called SymbolContainer.
- resolve-names.cc: I changed the Pre() function for parser::Statement to add the source range of a statement to both the current scope and all of its parents. This fixed a problem with finding the current scope based on the source position.
Original-commit: flang-compiler/f18@
085b2c18f3b6393a25beaa760a9d88a8ebd483f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
Peter Steinfeld [Wed, 31 Jul 2019 21:01:31 +0000 (14:01 -0700)]
[flang] Changes to enforce constraint C1130.
The constraint states that "If the locality-spec DEFAULT ( NONE ) appears in a DO CONCURRENT statement; a variable that is a local or construct entity of a scope containing the DO CONCURRENT construct; and that appears in the block of the construct; shall have its locality explicitly specified by that statement."
Here's a summary of the changes:
- In check-do.cc: Implemented the function
CheckDefaultNoneImpliesExplicitLocality() to do the checking. This involved
adding the class DoConcurrentVariableEnforce to walk the DO loop's block
looking for variable names. I also cleaned up the code a little in
CheckDoExpression() and EnforceConcurrentLoopControl().
- Added the test dosemantics05.f90
Original-commit: flang-compiler/f18@
2369aa805e36acafc2c59063cff3c4f5ae58be1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
Tree-same-pre-rewrite: false
Peter Steinfeld [Wed, 31 Jul 2019 17:31:19 +0000 (10:31 -0700)]
[flang] Noted the constraint being tested.
Original-commit: flang-compiler/f18@
471aea65d86c3e67d70c02aa1b4d967cf745e501
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Mon, 5 Aug 2019 21:51:02 +0000 (14:51 -0700)]
[flang] [OpenMP] parse tree changes for declarative directives (flang-compiler/f18#620)
1. Changes are to save provenance for directive names
2. check-omp-structure.* is updated to avoid assertion errors
3. Tests added now are only for the basic usages for the declarative directives,
more complete examples will be added once we start implementing the semantics
checks for declarative directives
Original-commit: flang-compiler/f18@
433e274f6876d5f0d6e2cc2e7e8c47ab01c07cc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/620
Peter Klausler [Mon, 5 Aug 2019 20:19:29 +0000 (13:19 -0700)]
[flang] Merge pull request flang-compiler/f18#623 from flang-compiler/pmk-fixes
Implement features to resolve bugs flang-compiler/f18#621 and flang-compiler/f18#622
Original-commit: flang-compiler/f18@
2cd989479c3463b93067a2add5725ec591016d29
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
peter klausler [Mon, 5 Aug 2019 19:47:43 +0000 (12:47 -0700)]
[flang] Remove obsolete code
Original-commit: flang-compiler/f18@
81a97453a82e2b9773ee02eb43d78fac7c4ede52
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
peter klausler [Mon, 5 Aug 2019 19:44:36 +0000 (12:44 -0700)]
[flang] Fold SIGN()
Original-commit: flang-compiler/f18@
521a02ad518be9323f80abedbf5101d3c313c2bf
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
peter klausler [Mon, 5 Aug 2019 17:46:54 +0000 (10:46 -0700)]
[flang] Fold DIGITS
Original-commit: flang-compiler/f18@
6c9adff7a6260e3eecc81626147e3290e2346e22
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
peter klausler [Mon, 5 Aug 2019 16:42:06 +0000 (09:42 -0700)]
[flang] Add DIGITS to intrinsic function table; fix results of some others
Original-commit: flang-compiler/f18@
6d5caef352e1ffe28315c27c4d46adfe36b55173
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
Peter Klausler [Fri, 2 Aug 2019 23:52:57 +0000 (16:52 -0700)]
[flang] Merge pull request flang-compiler/f18#619 from flang-compiler/klausler-patch-1
Update Extensions.md
Original-commit: flang-compiler/f18@
6e4f320aeb86a78eebb81b7702fcb73c7423e00f
Reviewed-on: https://github.com/flang-compiler/f18/pull/619
Peter Klausler [Fri, 2 Aug 2019 22:42:54 +0000 (15:42 -0700)]
[flang] Update Extensions.md
Add note about type parameter declarations needing to come first in a derived type definition.
Original-commit: flang-compiler/f18@
01358ac86e2a31b54900c38241a1ae01fedce0f6
Reviewed-on: https://github.com/flang-compiler/f18/pull/619
Peter Klausler [Fri, 2 Aug 2019 18:15:24 +0000 (11:15 -0700)]
[flang] Merge pull request flang-compiler/f18#611 from flang-compiler/pmk-bounds
Fold LBOUND and UBOUND intrinsic functions
Original-commit: flang-compiler/f18@
46d77ab006fd5a633ea9ab18b208ac9a7baee4f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
peter klausler [Fri, 2 Aug 2019 17:17:10 +0000 (10:17 -0700)]
[flang] Fix test failure, clean up for merging
Original-commit: flang-compiler/f18@
77bad2736698cbbb9911ac5efd3efe6ac5b6d01a
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
peter klausler [Thu, 1 Aug 2019 21:18:01 +0000 (14:18 -0700)]
[flang] Take suggestion from review comment
Original-commit: flang-compiler/f18@
7616b1f71b4bc203f76f9acce258d2f7190d0729
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Aug 2019 21:01:06 +0000 (14:01 -0700)]
[flang] Address review comment re: ALLOCATED intrinsic argument
Original-commit: flang-compiler/f18@
b24381c7df20b3e8157172e0f070ba602f39b820
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Aug 2019 20:53:59 +0000 (13:53 -0700)]
[flang] Fix LBOUND/UBOUND of associated expr, add test
Original-commit: flang-compiler/f18@
009095a9bc63ef4a4a7fa86f6d0ca3299fdcd409
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Aug 2019 19:32:17 +0000 (12:32 -0700)]
[flang] Fix LBOUND & UBOUND(function()), add tests
Original-commit: flang-compiler/f18@
1e093e9927f94a06a19700a6de26b5bfefa659d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Aug 2019 18:41:05 +0000 (11:41 -0700)]
[flang] Clean up some usage of std::optional lambda results
Original-commit: flang-compiler/f18@
9a66f9da9767d19875a229dbef2532b57b7a79a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Aug 2019 17:29:43 +0000 (10:29 -0700)]
[flang] Extract LBOUND/UBOUND folding into their own functions
Original-commit: flang-compiler/f18@
bf9146ad77c3db36b62d84093108048a807e528b
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Thu, 1 Aug 2019 17:07:11 +0000 (10:07 -0700)]
[flang] Address some review comments, fix crash
Original-commit: flang-compiler/f18@
7b7579eb5a896fb2b7d538f37a2df1a36b450f05
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Wed, 31 Jul 2019 21:13:42 +0000 (14:13 -0700)]
[flang] Handle association entities; fix problems found in testing
Original-commit: flang-compiler/f18@
c4d9fe95872decd9c305b4fec645229517a484c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Tue, 30 Jul 2019 23:51:25 +0000 (16:51 -0700)]
[flang] Fold LBOUND and UBOUND; do not insert empty triplets into whole array expressions
Original-commit: flang-compiler/f18@
82fba68a665802c990f35d14222f8df4ac4e1dee
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
peter klausler [Tue, 30 Jul 2019 18:33:06 +0000 (11:33 -0700)]
[flang] Implement GetShape with expression visitor
Original-commit: flang-compiler/f18@
d607d028478ed931ce4f56b5e4e4ef3628a6d15e
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
Tim Keith [Fri, 2 Aug 2019 17:20:14 +0000 (10:20 -0700)]
[flang] Merge pull request flang-compiler/f18#617 from flang-compiler/tsk-issue616
Fix bug with use-associated base of component reference
Original-commit: flang-compiler/f18@
ded6d831eecffdbba4a44bd6ac21f135a0905699
Reviewed-on: https://github.com/flang-compiler/f18/pull/617
Tim Keith [Fri, 2 Aug 2019 16:21:34 +0000 (09:21 -0700)]
[flang] Fix bug with use-associated base of component reference
When the base of a component reference (`a` in `a%b`) was use
associated, we were failing to follow it to the real symbol.
Fixes flang-compiler/f18#616.
Original-commit: flang-compiler/f18@
95bfac6f65eccfedd03d791f01267d43497c6153
Reviewed-on: https://github.com/flang-compiler/f18/pull/617
Peter Klausler [Fri, 2 Aug 2019 16:20:50 +0000 (09:20 -0700)]
[flang] Merge pull request flang-compiler/f18#613 from flang-compiler/pmk-component-scope
Correct scopes of components
Original-commit: flang-compiler/f18@
00bdacd6d416b6c2d22552a7a88bc599c6f5f1aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/613
peter klausler [Wed, 31 Jul 2019 23:20:55 +0000 (16:20 -0700)]
[flang] Do not inherit bindings as bare names, just components and type parameters
Original-commit: flang-compiler/f18@
c4c70a6a8160b7f8c675021f3cbe88d4054c3aab
Reviewed-on: https://github.com/flang-compiler/f18/pull/613
peter klausler [Wed, 31 Jul 2019 22:23:01 +0000 (15:23 -0700)]
[flang] Correct scopes of components and type parameters
Original-commit: flang-compiler/f18@
6d9f85a2410d82b0f9880d3e8cf358d7c0236f05
Reviewed-on: https://github.com/flang-compiler/f18/pull/613
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Thu, 1 Aug 2019 21:32:33 +0000 (14:32 -0700)]
[flang] [OpenMP] Add Sections and Single Construct check (flang-compiler/f18#585)
* [OpenMP] Add Sections and Single Construct check
Parse tree for OmpEndSingle needs to be modified to save the provenance
of END SINGLE directive and check its own clauses
* Update on reviews
1. PushContext is created to push new context with source provenance
2. Tweak the logic for SECTION nesting, treak Orphaned or wrong nesting
as the same error type
3. Make sure the check for NOWAIT clause only applies to the ones that
are not handled by parser.
Note that the case for DO or DO_SIMD will take effect after the
loop association work (parse tree change) is done. But I still list
them there for completeness.
4. Happen to find that NOWAIT is not accepted by PARALLEL SECTIONS,
fixed it in the parser.
Original-commit: flang-compiler/f18@
236cf1efea77b8af5c533aa55029ce49a2c2e72c
Reviewed-on: https://github.com/flang-compiler/f18/pull/585
Tim Keith [Thu, 1 Aug 2019 21:07:38 +0000 (14:07 -0700)]
[flang] Merge pull request flang-compiler/f18#614 from flang-compiler/tsk-generics
Improve handling of generics with same name as type or procedure
Original-commit: flang-compiler/f18@
a1e26df148c4d480178aa8b765aad4ceaaa5eae2
Reviewed-on: https://github.com/flang-compiler/f18/pull/614