Tim Keith [Thu, 1 Aug 2019 20:06:25 +0000 (13:06 -0700)]
[flang] Fix merging of use associated generics
When we use-associate a generic interface name and then add more
procedures to the generic, we create a new symbol for the merged
generic. That symbol has to include a pointer to the derived type
or procedure with the same name, just as the original generic did.
To achieve that, change `AddSpecificProcsFrom` to also copy those
fields from the original symbol and change its name to `CopyFrom`
to reflect its new purpose. Also, change it to take `GenericDetails`
instead of `Symbol` as its argument so we can't call it on the wrong
kind of symbol.
Original-commit: flang-compiler/f18@
1e22970e4352775df8a32e018435743786a66280
Reviewed-on: https://github.com/flang-compiler/f18/pull/614
Tim Keith [Wed, 31 Jul 2019 22:53:46 +0000 (15:53 -0700)]
[flang] Fix bug when writing empty generic to .mod file
When a generic interface had no specific procedures, we were writing
it the `.mod` file as `generic::g=>`, which is not valid Fortran.
Change to writing generics as interface blocks rather than generic
statements so that this case is handled. Include an access stmt if it
was declared private.
Also fix a bug in `test_errors.sh` where the expected/actual error
messages weren't sorted by line number correctly.
Original-commit: flang-compiler/f18@
1c32a289b53d787c0033ed45033db86afde33458
Reviewed-on: https://github.com/flang-compiler/f18/pull/614
Tree-same-pre-rewrite: false
Tim Keith [Tue, 30 Jul 2019 22:29:50 +0000 (15:29 -0700)]
[flang] Improve handling of generics with same name as type or procedure
Create symbols for generics in a pre-pass over the specification part so
it is easier to handle cases when they have the same name as a derived
type or subprogram. This is done by calling `PreSpecificationConstruct`
on each `SpecificationConstruct` of a specification part before we
continue walking it. The generics symbols are created there and the same
mechanism will be used to handle forward references to derived types.
Report an error when the same name is used for a generic interface,
derived type, and subprogram.
Improve the error message issued when a procedure and generic interface
have the same name but the procedure is not a specific of the generic.
Change `SayAlreadyDeclared` to report the error on the second occurence
of the name when possible. This can arise for declarations the are
processed out of order, e.g. contained subprograms and generic interfaces.
Avoid multiple "already declared" errors for the case when a contained
subprogram has the same name as a declared entity. We first create the
symbol with SubprogramNameDetails, then replace it with the entity (and
report the error), then replace it with the real subprogram (and get the
error again). By setting and checking the error flag we avoid the second
error.
Original-commit: flang-compiler/f18@
48fc0767834154a7dbe9d5a964e603855ca88ab5
Reviewed-on: https://github.com/flang-compiler/f18/pull/614
Tree-same-pre-rewrite: false
Tim Keith [Tue, 30 Jul 2019 13:13:19 +0000 (06:13 -0700)]
[flang] Merge pull request flang-compiler/f18#608 from flang-compiler/tsk-deref
Add a way to check and dereference a pointer
Original-commit: flang-compiler/f18@
31a3fae9f893565392e35fd3df1612615363dcdd
Reviewed-on: https://github.com/flang-compiler/f18/pull/608
Tim Keith [Mon, 29 Jul 2019 16:12:52 +0000 (09:12 -0700)]
[flang] Add a way to check and dereference a pointer
It is common to get a pointer, check it is not null, and dereference it.
Sometimes that requires a named temporary just to be able to do the check.
The macro `DEREF(p)` provides this capability: it asserts that `p` is not null
and returns `*p`. This is analagous to `.value()` on an `std::optional`.
We might want to add a way to disable `CHECK` and the check in `DEREF` together.
This change also includes some examples of making use of `DEREF`.
Original-commit: flang-compiler/f18@
d7aa90e55ac80c7f2460ab7b0cb6d1ef0c068938
Reviewed-on: https://github.com/flang-compiler/f18/pull/608
psteinfeld [Thu, 25 Jul 2019 23:41:14 +0000 (16:41 -0700)]
[flang] Merge pull request flang-compiler/f18#596 from flang-compiler/ps-variable-definition
Changes for constraint C1128
Original-commit: flang-compiler/f18@
d79137104ef0ab679b95d5393318aad4840e7e53
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
Peter Steinfeld [Thu, 25 Jul 2019 19:54:11 +0000 (12:54 -0700)]
[flang] More changes in response to review comments.
- resolve-names.cc: I reworded the message when a name appears in a
locality-spec when a name is used that cannot appear in a variable
definition context.
- tools.cc: I removed the unused functions ```IsValueDummy()``` and
```IsModifiable()```. I made the function ```GetAssociatedVariable()```
static. I cleaned up the code in ```GetAssociationRoot()```. I cleaned up
the code in ```IsOrContainsEventOrLockComponent()```. I added a TODO to
```WhyNotModifiable()``` and made some other improvements to it.
- tools.h: Removed some deleted and unnecessary functions.
- I fixed up a couple of tests related to the changes in error messages.
Original-commit: flang-compiler/f18@
47da8ff9c8c131a6fc7a4a6f4a8fa89c8b582b71
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
Peter Steinfeld [Tue, 23 Jul 2019 23:34:55 +0000 (16:34 -0700)]
[flang] Responses to previous review comments, specifically --
- expression.cc - fixed an error message. This required changing the tests
structconst0[3,4].f90
- tools.[h,cc] - Added a new function called ```WhyNotModifiable()``` to see
if a name can be modified. This function returns a string that describes why
the name cannot be modified. I changed the existing function
```IsModifiable()``` to call ```WhyNotModifiable()```. I fixed and
restructured the code for ```GetAssociationRoot()```. This involved creating
the mutually recursive function ```GetAssociatedVariable()```. I added a
check to see if a name is an INTENT(IN) dummy argument to the function
```IsVariableName()```.
- resolve-names.cc - Wrote the function ```SayWithReason()``` that allows an
arbitrary message to be added to an existing message. I changed the code in
```PassesLocalityChecks()``` to call the new function ```WhyNotModifiable()```
to get the specifics of why a variable name cannot be used in a variable
modification context and then call the new function ```SayWithReason()``` to
report the error. I also cleaned up the code as per Jean's suggestion.
Original-commit: flang-compiler/f18@
8a2f4bdfd24a568a87b3bcb9faa9bc87a68eee84
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
Tree-same-pre-rewrite: false
Peter Steinfeld [Fri, 19 Jul 2019 22:17:14 +0000 (15:17 -0700)]
[flang] Changes for constraint C1128.
Specifically, these changes enforce the last sentence of the constraint, which
prohibits names that cannot appear in a variable definition context from
appearing in a locality-spec. Here are the details.
- Created the function "IsModifiableName" to return "true" when its parameter
is the name of a variable that can appear in a variable definition context.
- Created the function "GetAssociationRoot" to follow construct associations
to potentially get to an underlying variable. This function is similar to
the existing "GetUltimate" function that follows use associations and host
associations. One difference is that "GetAssociationRoot" requires access
to the types "MaybeExpr" and "SomeExpr", which makes is inappropriate to put
into symbol.cc, which is where "GetUltimate" lives. Perhaps we should move
"GetUltimate" to tools.[h,cc].
- Generalized the functions "IsPureFunction" to "IsPureProcedure" since either
a pure function or subroutine can provide a context for variables that
cannot be modified. Changed "FindPureFunctionContaining" to
"FindPureProcedueContaining" to go along with this.
- Added the function "IsExternalInPureContext" to detect the case where a
nominally pure procedure potentially modifies a variable.
- Created the function "IsOrContainsEventOrLockComponent" to detect variables
that either are of EVENT_TYPE or LOCK_TYPE or contain components of these
types. Such variables cannot appear in variable definition contexts.
- Added the test resolve56.f90 to test most of these conditions. Note that I
only tested the new code from the perspective of locality-specs.
Original-commit: flang-compiler/f18@
c9d2507b74da881dda2eb11805a0394a415db2e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 25 Jul 2019 17:49:23 +0000 (10:49 -0700)]
[flang] Merge pull request flang-compiler/f18#603 from flang-compiler/pmk-fix
Fix IsVariable for Pete
Original-commit: flang-compiler/f18@
73e8c365e2b05904e0a3950f4c0813b445333ba1
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
peter klausler [Thu, 25 Jul 2019 17:04:22 +0000 (10:04 -0700)]
[flang] Fix bug
Original-commit: flang-compiler/f18@
482f882e3f8c5d6dae699949eb848001dc65bbc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
peter klausler [Wed, 24 Jul 2019 22:49:42 +0000 (15:49 -0700)]
[flang] Fix IsVariable for Pete
Original-commit: flang-compiler/f18@
4a24f74ae476f7d315bb68ed62f7dd39ad3b4d10
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 25 Jul 2019 17:30:22 +0000 (10:30 -0700)]
[flang] Merge pull request flang-compiler/f18#602 from flang-compiler/pmk-next
Fold more model inquiry intrinsics
Original-commit: flang-compiler/f18@
7d1aeea40979d4d545b0f21f079ccd39ac6012a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
peter klausler [Thu, 25 Jul 2019 17:16:28 +0000 (10:16 -0700)]
[flang] Address comments; allow "real,parameter::x=tiny(x)"
Original-commit: flang-compiler/f18@
e865358871da6211790b2869a58db7239d9c2e68
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
peter klausler [Wed, 24 Jul 2019 20:55:29 +0000 (13:55 -0700)]
[flang] Fold more model inquiry intrinsics
Original-commit: flang-compiler/f18@
a3d82893b768865aa51f105f92805f61a87d95f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
Tree-same-pre-rewrite: false
jeanPerier [Wed, 24 Jul 2019 17:07:30 +0000 (10:07 -0700)]
[flang] Merge pull request flang-compiler/f18#583 from flang-compiler/jpr-fix-582
Fix issue flang-compiler/f18#582: implicit ac-do-variable kind in expressions
Original-commit: flang-compiler/f18@
cebc2be4b1a05a921993e7c4d7a1082cd724679f
Reviewed-on: https://github.com/flang-compiler/f18/pull/583
Jean Perier [Wed, 17 Jul 2019 12:19:10 +0000 (05:19 -0700)]
[flang] Fix issue flang-compiler/f18#582: implicit ac-do-variable kind in expressions
Original-commit: flang-compiler/f18@
4150a5e41147940dd2b8e951becaf6ded0447fc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/583
Tim Keith [Wed, 24 Jul 2019 13:18:36 +0000 (06:18 -0700)]
[flang] Merge pull request flang-compiler/f18#591 from flang-compiler/tsk-issue586
Merge use-associated generics
Original-commit: flang-compiler/f18@
e0b28015f13201b7e18d2a4ad9a4b4939de4a08c
Reviewed-on: https://github.com/flang-compiler/f18/pull/591
Tim Keith [Thu, 18 Jul 2019 23:58:45 +0000 (16:58 -0700)]
[flang] Merge use-associated generics
When the same generic is use-associated from two different modules,
they must be merged together into a symbol with GenericDetails.
After that merger, if there is a use association of the same name
with a non-generic we have to report an error. So save the UseDetails
from the original USE in GenericDetails so we can create the
appropriate UseErrorDetails.
Fixes flang-compiler/f18#586.
Original-commit: flang-compiler/f18@
5067345f70af1fa262803535515dc644828b43ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/591
jeanPerier [Wed, 24 Jul 2019 09:40:30 +0000 (02:40 -0700)]
[flang] Merge pull request flang-compiler/f18#600 from flang-compiler/jpr-fix-598
Avoid interference between different construct association in name resolutions
Original-commit: flang-compiler/f18@
28c32a753879eb64f080872e39c129859cc6efba
Reviewed-on: https://github.com/flang-compiler/f18/pull/600
Jean Perier [Wed, 24 Jul 2019 09:06:31 +0000 (02:06 -0700)]
[flang] Address comment: make CHECK test more explicit
Original-commit: flang-compiler/f18@
a346462676b676d0abe2f98db2a80c8a4af3bd42
Reviewed-on: https://github.com/flang-compiler/f18/pull/600
Jean Perier [Tue, 23 Jul 2019 15:57:40 +0000 (08:57 -0700)]
[flang] Avoid interference between different association variable resoltions
Fix issue 598 and related issues.
Transform resolve-names.cc ConstructVisitor association_ member into a
stack so that different association construct (select-type, select-rank,
change-team, associate) imbrication/succession do not interfere with each
other leading to wrong erronous symbol resolution.
Original-commit: flang-compiler/f18@
5781f29ed6d3d235065e4a873a007431f6a48c02
Reviewed-on: https://github.com/flang-compiler/f18/pull/600
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 23 Jul 2019 22:12:29 +0000 (15:12 -0700)]
[flang] Merge pull request flang-compiler/f18#601 from flang-compiler/pmk-fixes
Fix legal pointer target test
Original-commit: flang-compiler/f18@
751cb64ae9935586123088fafc5880f34c4422f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
peter klausler [Tue, 23 Jul 2019 21:57:46 +0000 (14:57 -0700)]
[flang] Do not remove things from .gitignore
Original-commit: flang-compiler/f18@
27c896ea0b36cee706133e65db8f705a6f85155a
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
peter klausler [Tue, 23 Jul 2019 21:07:49 +0000 (14:07 -0700)]
[flang] Review comment
Original-commit: flang-compiler/f18@
784d2cc6dfb13dd4bd060b649e3f862ab272d59d
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Tue, 23 Jul 2019 20:42:06 +0000 (13:42 -0700)]
[flang] Fix handling of ALLOCATABLE components in GetLastTarget
Original-commit: flang-compiler/f18@
6b3b404bdce4963cf4a87d5c69df55a291b65e04
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Tue, 23 Jul 2019 19:35:56 +0000 (12:35 -0700)]
[flang] Fix pointer target check
Original-commit: flang-compiler/f18@
8249bc8cd4a854f89cad38ab7292134a9facfe16
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Tue, 23 Jul 2019 18:45:55 +0000 (11:45 -0700)]
[flang] Improve comments
Original-commit: flang-compiler/f18@
277fb1cc917d46760100dcef27d137d82021d903
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Tue, 23 Jul 2019 17:55:56 +0000 (10:55 -0700)]
[flang] Improve expression traversal, use it more for tools
Original-commit: flang-compiler/f18@
4980b928bc61a392ee50cdac4129f905ed1e4559
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Mon, 22 Jul 2019 21:06:06 +0000 (14:06 -0700)]
[flang] Add root/ to .gitignore, remove old build-specific directory names
Original-commit: flang-compiler/f18@
d5843aa319a3375142eeae1476329eb1835f6da8
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Mon, 22 Jul 2019 21:05:33 +0000 (14:05 -0700)]
[flang] Reimplement GetLastSymbol with expression visitor
Original-commit: flang-compiler/f18@
a996751e972a6ce6c4bab4caab03797c91c79bd2
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
peter klausler [Mon, 22 Jul 2019 21:05:07 +0000 (14:05 -0700)]
[flang] Fix crash
Original-commit: flang-compiler/f18@
e00864f17e956d2e8805cf794cd677b56fc92d92
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
jeanPerier [Tue, 23 Jul 2019 12:36:17 +0000 (05:36 -0700)]
[flang] Merge pull request flang-compiler/f18#544 from flang-compiler/jpr-reshape-only-folding
RESHAPE without shared runtime/front-end descriptor API
Original-commit: flang-compiler/f18@
24856b82387a6d729b8d50314bc3e67200ec6f86
Reviewed-on: https://github.com/flang-compiler/f18/pull/544
Due to a conflicting rebase during the linearizing of flang-compiler/f18, this commit squashes a number of other commits:
flang-compiler/f18@
2ec1d85d398e4171b6d77a21ccbe1fffec9e420d Implement RESHAPE folding on Constant<T> only
flang-compiler/f18@
539463053942adf93ae015af800934e73d8942e3 Enable RESHAPE folding tests
flang-compiler/f18@
83b2b86253c9536bb5698526d461f4c68c1affaf Answer review comment + Add a common path for intrsinic function folding before specializing the folding per type. + Make reshape folding return an "invalid" intrinsic after errors are met so that warnings do not get re-generated. + Misc style changes
flang-compiler/f18@
2e5c29f2805e1e8dfdb8caa8f13eac9472c4c3c2 add missing file to previous commit...
flang-compiler/f18@
9bd5ad9875e894a9a86e94f1e2153cc2cd5ef8d5 Document issue #518 workaround
flang-compiler/f18@
a4f8f518318f01c298392f3c6e3b8745e34c2953 Go back to clang-format version 7.01
flang-compiler/f18@
e871e58a5218504d9c92056058458706f3ad0c27 answer comment regarding naming and interface
flang-compiler/f18@
145c7c1ecee57ff557527c0e6eb5655f43f00e39 Merge branch 'master' into jpr-reshape-only-folding Too many logical conflicts to simply rebase.
Peter Klausler [Mon, 22 Jul 2019 16:34:19 +0000 (09:34 -0700)]
[flang] Merge pull request flang-compiler/f18#597 from flang-compiler/pmk-fixes-2
Fix a couple of crashes on tests, refactor Constant bounds information a bit
Original-commit: flang-compiler/f18@
e980d641377a18e30c55a8e18a85daee2a4b5607
Reviewed-on: https://github.com/flang-compiler/f18/pull/597
peter klausler [Fri, 19 Jul 2019 23:17:07 +0000 (16:17 -0700)]
[flang] Avoid crash on bad subscript, refactor Constant bounds a bit
Original-commit: flang-compiler/f18@
c2e01e838665e1f79e7419a56c2ffaf3475ba140
Reviewed-on: https://github.com/flang-compiler/f18/pull/597
peter klausler [Fri, 19 Jul 2019 21:49:25 +0000 (14:49 -0700)]
[flang] Do not add invalid subscript triple to whole assumed-size array reference
Original-commit: flang-compiler/f18@
71c134a55206c173acabe02bfd863080f1625117
Reviewed-on: https://github.com/flang-compiler/f18/pull/597
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 22 Jul 2019 16:33:57 +0000 (09:33 -0700)]
[flang] Merge pull request flang-compiler/f18#595 from flang-compiler/pmk-fixes
Avoid crashing in check-allocate.cc on CLASS(*) source
Original-commit: flang-compiler/f18@
95f76866e4366b9f5b9e56498b4918a51af882b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/595
peter klausler [Fri, 19 Jul 2019 20:50:39 +0000 (13:50 -0700)]
[flang] Avoid crashing in check-allocate.cc on CLASS(*)
Original-commit: flang-compiler/f18@
7ba4275998262a2bd277928baa9e63112004d7f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/595
jeanPerier [Mon, 22 Jul 2019 08:36:16 +0000 (01:36 -0700)]
[flang] Merge pull request flang-compiler/f18#593 from flang-compiler/jpr-fix-515
Fix issue flang-compiler/f18#515
Original-commit: flang-compiler/f18@
415d6d611062b5bc8ccfd156557f70352bf00174
Reviewed-on: https://github.com/flang-compiler/f18/pull/593
Jean Perier [Fri, 19 Jul 2019 14:20:47 +0000 (07:20 -0700)]
[flang] Fix issue flang-compiler/f18#515
Do not emit "is not a branch target" warning for old action-stmt just
because these action-stmt are depreciated. The depreciated aspect of
these features is already handled via -Mstandard.
Original-commit: flang-compiler/f18@
f7d124d8cd3d97ee81208121a336f14fef9595ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/593
Peter Klausler [Fri, 19 Jul 2019 17:49:00 +0000 (10:49 -0700)]
[flang] Merge pull request flang-compiler/f18#590 from flang-compiler/pmk-fixes
Roll up some fixes and extensions
Original-commit: flang-compiler/f18@
561719d276695b8316836ebf15ca72da22feb55c
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
peter klausler [Fri, 19 Jul 2019 17:37:55 +0000 (10:37 -0700)]
[flang] address review comment
Original-commit: flang-compiler/f18@
7012b6178654bca8b64ab9db334bb053b5c01965
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
peter klausler [Thu, 18 Jul 2019 22:26:17 +0000 (15:26 -0700)]
[flang] document a non-extension
Original-commit: flang-compiler/f18@
625daf5218d42e2f20daef53c4df204973b3bc39
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Thu, 18 Jul 2019 22:08:50 +0000 (15:08 -0700)]
[flang] Accept NULL() in struct constructor for ALLOCATABLE component
Original-commit: flang-compiler/f18@
7aee0e4852f34cc85ba0de9cc44fbed167029675
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Thu, 18 Jul 2019 20:57:21 +0000 (13:57 -0700)]
[flang] Document intent to not support modules & programs whose names conflict with contents
Original-commit: flang-compiler/f18@
e23c48191105f1ffe472caaa6baf10c937521190
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Wed, 17 Jul 2019 22:58:28 +0000 (15:58 -0700)]
[flang] Support SELECTED_CHAR_KIND("DEFAULT")
Original-commit: flang-compiler/f18@
c05c96c47452555e8cc81e77b2a44ad2339e6f53
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Wed, 17 Jul 2019 21:29:11 +0000 (14:29 -0700)]
[flang] Document BOZ initializers for REAL
Original-commit: flang-compiler/f18@
d72d5feb01e374e6874826f41aaafd25995c1a19
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Wed, 17 Jul 2019 21:26:35 +0000 (14:26 -0700)]
[flang] Allow BOZ initializers on REAL parameters, too.
Original-commit: flang-compiler/f18@
e1ab6b316e6d28d7ff8733ad19b4bdc5feaf0745
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Wed, 17 Jul 2019 21:14:09 +0000 (14:14 -0700)]
[flang] Silence spurious overflow warning on negative int4->int2 folding
Original-commit: flang-compiler/f18@
5f1cad3911e791c47ef83e729a612d7f49022355
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
peter klausler [Wed, 17 Jul 2019 19:51:52 +0000 (12:51 -0700)]
[flang] Extension: relax "same kind" rules on some intrinsics
Original-commit: flang-compiler/f18@
ce5130f84bcb78007180ee87661c84b1483a476c
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 16 Jul 2019 23:05:56 +0000 (16:05 -0700)]
[flang] Merge pull request flang-compiler/f18#580 from flang-compiler/pmk-fixes
Allow forward references to procedure interfaces in derived types (fi…
Original-commit: flang-compiler/f18@
8c63aa94972fb3f7b88f23fa1b78f8b67ffa8732
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
peter klausler [Tue, 16 Jul 2019 22:45:00 +0000 (15:45 -0700)]
[flang] review comment
Original-commit: flang-compiler/f18@
f5c46291ece846986c20dd1dbeeff433e0e20462
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
peter klausler [Tue, 16 Jul 2019 22:32:59 +0000 (15:32 -0700)]
[flang] Fix bug flang-compiler/f18#579 while here
Original-commit: flang-compiler/f18@
eefbcdcb544573c7cdf5c47e8ff24ed0412f144f
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
Tree-same-pre-rewrite: false
peter klausler [Tue, 16 Jul 2019 21:37:56 +0000 (14:37 -0700)]
[flang] Allow forward references to procedure interfaces in derived types (fixing flang-compiler/f18#571 more)
Original-commit: flang-compiler/f18@
c1aeeae7765527c40c1934d4d4d15086bf88758f
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
Tree-same-pre-rewrite: false
Tim Keith [Tue, 16 Jul 2019 18:09:36 +0000 (11:09 -0700)]
[flang] Merge pull request flang-compiler/f18#577 from flang-compiler/tsk-issue572
Allow forward reference to binding name in type-bound generic
Original-commit: flang-compiler/f18@
3ed8a8a35619ad3c84bae12ab7f308677b7fb044
Reviewed-on: https://github.com/flang-compiler/f18/pull/577
Tim Keith [Tue, 16 Jul 2019 00:09:03 +0000 (17:09 -0700)]
[flang] Allow forward reference to binding name in type-bound generic
Type-bound generic statements can have binding names that refer to
bindings that occur later in the type. So save a map of generic to
binding names and process them when we get to the end of the
type-bound procedure part. This is similar to how specific procedures
of generic identifiers are handled.
Also detect duplicate binding names for a type-bound generic.
Fixes issue flang-compiler/f18#572.
Original-commit: flang-compiler/f18@
d58bb77cfa8cde2838a5eaba3e44956bdaa042e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/577
Peter Klausler [Tue, 16 Jul 2019 17:55:27 +0000 (10:55 -0700)]
[flang] Merge pull request flang-compiler/f18#565 from flang-compiler/pmk-fixes
When creating symbols for intrinsics, do not put them in the global s…
Original-commit: flang-compiler/f18@
38789942a74f83d38c1132e96708158738ae0784
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
peter klausler [Tue, 16 Jul 2019 17:53:39 +0000 (10:53 -0700)]
[flang] Fix typo
Original-commit: flang-compiler/f18@
f7d9f5bd7c6b03344e0cb2030e928cf1945f5d79
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
peter klausler [Tue, 16 Jul 2019 16:56:41 +0000 (09:56 -0700)]
[flang] Address review comment
Original-commit: flang-compiler/f18@
5d6749c3d4f5b940a99421ec645961924aa5d8d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
peter klausler [Tue, 16 Jul 2019 00:11:54 +0000 (17:11 -0700)]
[flang] Fix flang-compiler/f18#571: forward reference to interface
Original-commit: flang-compiler/f18@
5e00d1699c0ca6fe656447ac10c4184b86e8e992
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
peter klausler [Mon, 15 Jul 2019 20:04:32 +0000 (13:04 -0700)]
[flang] Handle USE and host associations in characteristics analysis
Original-commit: flang-compiler/f18@
1625f72e35a4ec5f8626b2dd07776f49f1a84f5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
peter klausler [Mon, 15 Jul 2019 17:12:46 +0000 (10:12 -0700)]
[flang] fix crash in ASSOCIATED() intrinsic with two arguments
Original-commit: flang-compiler/f18@
1a393ff43b627f1cf111d6a8a1a5403e285d7431
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
peter klausler [Thu, 11 Jul 2019 23:09:02 +0000 (16:09 -0700)]
[flang] Make warning about exponent letters more useful
Original-commit: flang-compiler/f18@
9c9aaacd7b43c4101140758b1924343b745e1f88
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
peter klausler [Thu, 11 Jul 2019 22:11:40 +0000 (15:11 -0700)]
[flang] When creating symbols for intrinsics, do not put them in the global scope, and do not emit them to module files.
Original-commit: flang-compiler/f18@
9907026609122ed5842340ae5b4de5c353846dec
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
jeanPerier [Tue, 16 Jul 2019 09:20:08 +0000 (02:20 -0700)]
[flang] Merge pull request flang-compiler/f18#552 from flang-compiler/jpr-fix-518
Fix issues flang-compiler/f18#517, flang-compiler/f18#518, and flang-compiler/f18#546
Original-commit: flang-compiler/f18@
bc3c549d48a4166c63fbfb312adf0fc7079adeb1
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Jean Perier [Wed, 10 Jul 2019 15:44:05 +0000 (08:44 -0700)]
[flang] Add fix for issue flang-compiler/f18#517
Original-commit: flang-compiler/f18@
d9bb6890d781b85cee4b820fd0c43eacfc7919e6
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Jean Perier [Wed, 10 Jul 2019 10:53:25 +0000 (03:53 -0700)]
[flang] Answer comment: split cannondo new tests
Original-commit: flang-compiler/f18@
7ebf7f72b039385072e6f9fc0e182e8491258f8c
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
Jean Perier [Tue, 9 Jul 2019 18:54:40 +0000 (11:54 -0700)]
[flang] Add non standard feature for labeled do not ending with END DO or CONTINUE
* The warning was already here, this commit only refactors things so that
it can be controled with -Mstandard.
* Also makes the warning point to the do-stmt and adds a note to the warning
pointing to the statements where it ends.
Original-commit: flang-compiler/f18@
11e1eb6edd4a88b7d6517ecfc3378e95757a3a24
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
Jean Perier [Tue, 9 Jul 2019 17:40:14 +0000 (10:40 -0700)]
[flang] Answer comments
* Support target label of label-do on all executable constructs as well as
forall and where.
* Re-oder and rename related checks in resolve-labels.cc
Original-commit: flang-compiler/f18@
e5ac8a1660511a7e48f0b2075f87ca1d8dbe23d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
Jean Perier [Mon, 8 Jul 2019 16:19:07 +0000 (09:19 -0700)]
[flang] Fix issues 518 and 546
- Only allow out-of-scope label target for label-do-stmt
when the label is on an end-stmt of a scope directly nested
into the one of the label-do-stmt.
- Also transform label-do-stmt into non-label-do constructs
so that later phases do not have to handle label-do-stmt.
Original-commit: flang-compiler/f18@
91cff2f29698506ac95138107c5f0c625fa237ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
Tim Keith [Tue, 16 Jul 2019 00:00:04 +0000 (17:00 -0700)]
[flang] Merge pull request flang-compiler/f18#568 from flang-compiler/tsk-test
Improvements to semantics tests
Original-commit: flang-compiler/f18@
4dde0d7daae7504ec87bccbaee5c9909cc406f05
Reviewed-on: https://github.com/flang-compiler/f18/pull/568
Tim Keith [Fri, 12 Jul 2019 19:37:16 +0000 (12:37 -0700)]
[flang] Improvements to semantics tests
Change test scripts so that cmake passes in the path to the `f18`
that it just built. They no longer have to use relative paths.
Simplify argument passing in test scripts by sharing it in `common.sh`.
Move `if_arith01.f90`, `if_construct01.f90`, `if_stmt01.f90` to `ERROR_TESTS`.
As it was, nothing was being tested on them.
For `test_error.sh`, find the include directory relative to `f18` and
pass that in with a `-I` option. Eliminate the temporary definitions of
`iso_fortran_env`, `iso_c_binding`, `ieee_exceptions` in the tests
because the "real" ones are now available.
The tests that are run with `test_any.sh` could probably have similar
changes, but they are not part of this commit.
Original-commit: flang-compiler/f18@
b62fe489be9aefeebb11954a6436285a1b5e6840
Reviewed-on: https://github.com/flang-compiler/f18/pull/568
Tim Keith [Mon, 15 Jul 2019 21:22:28 +0000 (14:22 -0700)]
[flang] Merge pull request flang-compiler/f18#576 from flang-compiler/tsk-pass
Procedure distinguishability rules for operators
Original-commit: flang-compiler/f18@
fc35c3ed0b41e0b722673a421f8b008fffa9d275
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
Tim Keith [Mon, 15 Jul 2019 20:05:42 +0000 (13:05 -0700)]
[flang] Procedure distinguishability rules for operators
Generic operators and assignment have different rules than generic
names for their procedures being distinguishable.
Implement those rules in `DistinguishableOpOrAssign`. The rules are
considerably simpler: they must have the name number of dummy arguments
and at least one pair in the same position must be distinguishable.
Fixes issue flang-compiler/f18#563.
Original-commit: flang-compiler/f18@
276bb082060dcbdb7d2b2a7dbe344bb72ecddab6
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
Peter Klausler [Mon, 15 Jul 2019 20:27:15 +0000 (13:27 -0700)]
[flang] Merge pull request flang-compiler/f18#569 from flang-compiler/pmk-omp
Add source provenance to OpenMP parse tree nodes; clean things up.
Original-commit: flang-compiler/f18@
03786ec4073cd04103a6e4385b0cd1873cebadc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
peter klausler [Mon, 15 Jul 2019 16:49:25 +0000 (09:49 -0700)]
[flang] Separate keyword from clauses in provenance of construct directives
Original-commit: flang-compiler/f18@
9994d2351eb7329e4175dce693089b0a81e198a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
peter klausler [Mon, 15 Jul 2019 16:34:04 +0000 (09:34 -0700)]
[flang] Ensure that provenance is preserved in move ctor/assignment of Verbatim
Original-commit: flang-compiler/f18@
fcb5513486ed9efec4d145fdfd253a6a86aafe43
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 23:16:40 +0000 (16:16 -0700)]
[flang] Complete source provenance on OMP constructs (except ATOMIC)
Original-commit: flang-compiler/f18@
8f6e93d579e5a7263296c33323bed5d92c5b8427
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 22:27:29 +0000 (15:27 -0700)]
[flang] Combine BARRIER/TASKWAIT/TASKYIELD
Original-commit: flang-compiler/f18@
c56c893a05648475eadfeece8fdd02c8b3ef224f
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 21:23:16 +0000 (14:23 -0700)]
[flang] Convert more empty classes to enums
Original-commit: flang-compiler/f18@
9cf8b9eea7162c8cbee347c3e8333bed046011d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 20:57:58 +0000 (13:57 -0700)]
[flang] Change more empty classes into enums
Original-commit: flang-compiler/f18@
e73b0368b226f72cca7f32ae1742758324700649
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 20:35:22 +0000 (13:35 -0700)]
[flang] Change some empty classes into enums
Original-commit: flang-compiler/f18@
652e47455660c7bb5ba41f791f1f42533ac30321
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 19:46:39 +0000 (12:46 -0700)]
[flang] more progress
Original-commit: flang-compiler/f18@
1a219e50732ab5bd8c79ec9e85609c0b64598c69
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 18:12:34 +0000 (11:12 -0700)]
[flang] Eliminate a lot of needless indirection in OMP data structures
Original-commit: flang-compiler/f18@
47c6cb0ba9f1bef1ce50071b18a33c584c2973aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 17:24:53 +0000 (10:24 -0700)]
[flang] Restore alphabetical order to OpenMP nodes in parse tree dumper
Original-commit: flang-compiler/f18@
88b1a26035b5be64d4e3f70293555d8ee14b3074
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 17:11:01 +0000 (10:11 -0700)]
[flang] Define and use OpenMPConstructDirective
Original-commit: flang-compiler/f18@
cd716fa90702613fc1cd1596705dbe6e85b07d57
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Fri, 12 Jul 2019 16:30:19 +0000 (09:30 -0700)]
[flang] Refinements; builds and passes tests again
Original-commit: flang-compiler/f18@
a83410a4400a05b2b21e0207c605b5351bda6dbe
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
peter klausler [Thu, 11 Jul 2019 23:50:43 +0000 (16:50 -0700)]
[flang] Add "..."_id token syntax for complete tokens with lookahead
Original-commit: flang-compiler/f18@
19695ccfa4f2db50fb65af3f4db1bb595ef2f568
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
Tim Keith [Mon, 15 Jul 2019 19:45:40 +0000 (12:45 -0700)]
[flang] Merge pull request flang-compiler/f18#567 from flang-compiler/tsk-pass-2
Use passed-object dummy in distinguishability checks
Original-commit: flang-compiler/f18@
c87fbc387f8a7fbe82334427ed5280e2ef906ae6
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
Tim Keith [Fri, 12 Jul 2019 19:12:12 +0000 (12:12 -0700)]
[flang] Use passed-object dummy in distinguishability checks
Complete the checks for distinguishable specifics procedure in a generic
by considering any passed-object dummy arguments.
C1514 rule 3 is implemented and the checks for the other rules are
extended to consider the PASS attribute, including the concept of the
"effective" position of an argument in an argument list, computed by
ignoring passed-object arguments.
Add `pass` to `characteristics::DummyArgument` to mark each
passed-object dummy argument.
Change symbols to store the index of the passed-object dummy argument
rather than its symbol.
Check that specifics of a type-bound generic are distinguishable only
after all of the procedure bindings have been processed. They don't have
to be before the generic.
Original-commit: flang-compiler/f18@
2751490f95fa5ca321c912330aca1091cdbc2f70
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
Tim Keith [Thu, 11 Jul 2019 16:27:25 +0000 (09:27 -0700)]
[flang] Add IsGlobal and IsDerivedType to Scope
These are properties of Scopes that are checked frequently
so add IsGlobal and IsDerivedType for convenience.
Original-commit: flang-compiler/f18@
aebb2379d71fbc00f544cc7d831e032fd60564a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Thu, 11 Jul 2019 23:32:34 +0000 (16:32 -0700)]
[flang] Merge pull request flang-compiler/f18#566 from flang-compiler/by-mp-validity
Add missing THREADS and SIMD clauses
Original-commit: flang-compiler/f18@
ade72d803d2b795d30244a4f9e72c5f26dafd454
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
peter klausler [Thu, 11 Jul 2019 20:54:12 +0000 (13:54 -0700)]
[flang] Ensure that no OMP clause is a prefix of a later one in the grammar; then alphabetize the order.
Original-commit: flang-compiler/f18@
7f4b4f8e74d003e87523ae62e7c1a82b8441299a
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
Jinxin Yang [Thu, 11 Jul 2019 19:19:51 +0000 (12:19 -0700)]
[flang] add ORDERED construct w/ THREADS and SIMD clauses (parse error)
Original-commit: flang-compiler/f18@
23a71aed74ee34ddd4dbf80ac3f906bf8c255bd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
Tree-same-pre-rewrite: false
Jinxin (Brian) Yang [Thu, 11 Jul 2019 22:18:09 +0000 (15:18 -0700)]
[flang] Examples of Composite and Combined constructs (flang-compiler/f18#558)
* Examples of Composite and Combined constructs
2.8.3 Loop SIMD Construct
2.11.1 Parallel Loop Construct
2.11.3 Parallel Loop SIMD Construct
Not in the implementation:
2.8.3 DO SIMD: A list item may appear in a linear or firstprivate clause but not both
Original-commit: flang-compiler/f18@
75d9c1a081474c02a3e106ac13924134e06793ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/558
Peter Klausler [Thu, 11 Jul 2019 20:00:21 +0000 (13:00 -0700)]
[flang] Merge pull request flang-compiler/f18#561 from flang-compiler/pmk-fixes
Better name resolution for intrinsics
Original-commit: flang-compiler/f18@
33aceaec8f1fffbaa959806fea479af6bf602a6b
Reviewed-on: https://github.com/flang-compiler/f18/pull/561
peter klausler [Thu, 11 Jul 2019 18:34:01 +0000 (11:34 -0700)]
[flang] Better name resolution for intrinsics
Original-commit: flang-compiler/f18@
31fd9c82e9bd90b03bd37accd3d9f187ccbfa979
Reviewed-on: https://github.com/flang-compiler/f18/pull/561
Tim Keith [Thu, 11 Jul 2019 15:52:52 +0000 (08:52 -0700)]
[flang] Merge pull request flang-compiler/f18#559 from flang-compiler/tsk-symbols3
Move some functions to semantics/tools.h
Original-commit: flang-compiler/f18@
e133247901d9618cca73dd5557923ff642da93cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tim Keith [Thu, 11 Jul 2019 13:29:31 +0000 (06:29 -0700)]
[flang] Change two member functions of DerivedTypeDetails to non-member
In `OrderParameterNames` and `OrderParameterDeclarations` it was
always true that `this == &type.get<DerivedTypeDetails>()` which
meant that `this` was redundant.
So convert them to non-member functions in `tools.h` that get the
details from the symbol passed in. This makes life simpler for the
callers.
Original-commit: flang-compiler/f18@
81710d4e6ec9e316d95b955a1efd253d9c485fef
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tim Keith [Thu, 11 Jul 2019 01:20:27 +0000 (18:20 -0700)]
[flang] Move various Instantiate functions to tools.cc
Move these functions from scope.cc, symbol.cc, type.cc into tools.cc:
Scope::FindOrInstantiateDerivedType
Scope::InstantiateDerivedType
Scope::InstantiateIntrinsicType
Symbol::Instantiate
DerivedTypeSpec::ProcessParameterExpressions
DerivedTypeSpec::Instantiate
This eliminates some dependencies in these files on SemanticsContext,
FoldingContext, etc.
It also allows three of the functions to be private to tools.cc
because they are only called from the others.
Original-commit: flang-compiler/f18@
48c6efbf95390446fa10ca61b3e7f6b7db6c836d
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tree-same-pre-rewrite: false