Commit graph

2118 commits

Author SHA1 Message Date
Steve Scalpone 6e4c8b88c5 [flang] Create OpenMP-semantics.md
Initial markdown document.

Original-commit: flang-compiler/f18@787a0ca058
Reviewed-on: https://github.com/flang-compiler/f18/pull/692
Tree-same-pre-rewrite: false
2019-08-27 14:38:48 -07:00
Jinxin Yang 23a7f38741 [flang] [OpenMP] flang-compiler/f18#691 Update on Tim and Varun's review
Change CheckMatching to return `beginDir`, which hides the unnecessary
`std::get<>` for `endDir`.

Original-commit: flang-compiler/f18@d9689e10f4
2019-08-29 10:19:36 -07:00
Jinxin Yang f6273d7194 [flang] [OpenMP] structural checks for PARALLEL SECTIONS
Original-commit: flang-compiler/f18@c18452159d
2019-08-29 10:19:36 -07:00
Jinxin Yang ffb88549cb [flang] [OpenMP] add Begin and End Directive matching check
Straightforward check for Begin and End directive of:
1. Block related constructs
2. Loop related constructs (End directive is optional)
3. Sections related constructs

Original-commit: flang-compiler/f18@d0436f13ee
2019-08-29 10:19:36 -07:00
Jinxin Yang 0a85616b07 [flang] [OpenMP] update validity check for OmpNowait.
Because now we set the flag for `End` directives that accept clauses,
no need to check the specific directives anymore.

Original-commit: flang-compiler/f18@a5cdc4b035
2019-08-29 10:19:36 -07:00
Jean Perier 296b0d9374 [flang] Remove unused function after last commit
Original-commit: flang-compiler/f18@029fbf64c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/689
2019-08-28 05:50:23 -07:00
Jean Perier d93f493438 [flang] Address comment: store current enum value in an int
During enumerator name resolution, instead of keeping the current
enumerator value inside an expression, fold it to an int and keep
it as an int. This is clearer and will be easier if one wants to
provide some enum type size optimization.

Original-commit: flang-compiler/f18@4e49d5396c
Reviewed-on: https://github.com/flang-compiler/f18/pull/689
Tree-same-pre-rewrite: false
2019-08-28 04:58:38 -07:00
Jean Perier 93aefc3940 [flang] Address comments: Update comments
Original-commit: flang-compiler/f18@6308613244
Reviewed-on: https://github.com/flang-compiler/f18/pull/689
Tree-same-pre-rewrite: false
2019-08-28 03:35:40 -07:00
Jean Perier f23200963f [flang] Simplify name resolution visitor for parser::Enumerator
Do not define a Pre and a Post, simply walk the expression
with Walk in Pre to resolve the names inside the expression
before evaluating it.

Original-commit: flang-compiler/f18@b0e3c1691e
Reviewed-on: https://github.com/flang-compiler/f18/pull/689
Tree-same-pre-rewrite: false
2019-08-27 07:14:51 -07:00
Jean Perier e3b5330fda [flang] Introduce IsNamedConstant to hide attr::PARAMETER details
for named constant that are actually enumerators.

Original-commit: flang-compiler/f18@d9c4888b72
Reviewed-on: https://github.com/flang-compiler/f18/pull/689
Tree-same-pre-rewrite: false
2019-08-27 07:14:51 -07:00
Tim Keith 396a659413 [flang] Resolve index in pointer assignment to array element
When the LHS of a pointer assignment is an array element, the
index must be resolved.

Fixed flang-compiler/f18#684.

Original-commit: flang-compiler/f18@c39c7872d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/687
2019-08-26 17:37:52 -07:00
Kiran Chandramohan 911cb63719 [flang] Fix for segfault in invalid proc interface message
The segfault happened due to a missing argument.

Original-commit: flang-compiler/f18@8a4f49e86d
Reviewed-on: https://github.com/flang-compiler/f18/pull/693
2019-08-27 23:28:15 +01:00
peter klausler 142fed87c1 [flang] Clean up omp_lib.h
Original-commit: flang-compiler/f18@7119cd0534
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
2019-08-27 11:17:43 -07:00
peter klausler 9d5d73aa77 [flang] Reformat omp_lib.h
Original-commit: flang-compiler/f18@892d91b161
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
2019-08-27 09:28:30 -07:00
Steve Scalpone 5c62bfb4f8 [flang] Implement int_ptr_kind.
Split omp_lib.F90 into two files: a Fortran file used to
create the omp_lib module and a .h file that can be used
directly, which apparently some codes do. Because of the
split, and wanting to avoid forcing use isc_c_binding,
use int_ptr_kind()  instead of c_intptr_t.

Original-commit: flang-compiler/f18@ce6a9fb173
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
2019-08-26 14:58:10 -07:00
Steve Scalpone 9b5e691814 [flang] Add the OpenMP module.
Original-commit: flang-compiler/f18@09d8b0d6e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
2019-08-26 09:57:06 -07:00
David Truby 1281b9c5fc [flang] Misc changes for review
Original-commit: flang-compiler/f18@6d9ddb8f5e
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
2019-08-23 21:17:57 +01:00
David Truby 0adca8bedc [flang] Fix for builds with libc++9 and libstdc++10
Original-commit: flang-compiler/f18@137de8a1cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
Tree-same-pre-rewrite: false
2019-08-23 14:57:05 +01:00
Tim Keith 51fe223916 [flang] Fix bug with statement functions
When the name of a statement function was previously declared, we
weren't correctly recognizing it as a statement function. E.g.
```
integer :: f, i
f(i) = i + 1
```

`f` was entered in the symbol table with `EntityDetails` and the
`parser::Name` on the first line was resolved to that symbol.
On the second line we replaced the symbol for `f` in the scope
with a subprogram symbol, but that didn't change the symbol in
the first `parser::Name`.

The fix requires:
1. don't erase the original symbol for `f`, just replace its details
2. when we erase the symbol for `f` in the subprogram scope, don't
   unresolve it

Original-commit: flang-compiler/f18@31212686ea
2019-08-26 15:46:49 -07:00
Jean Perier 98af2162d0 [flang] Fix intrinsic table probing issue with DOUBLE COMPLEX
The probing table was only expecting REAL for kind code
`KindCode::doublePrecision` that is also used for
`DoublePrecisionComplex`.
Add related tests.

Original-commit: flang-compiler/f18@342ed7e769
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
2019-08-23 05:37:37 -07:00
Jean Perier 252e22ea97 [flang] Fix issue: Enforce specific intrinsic characteristics
Fix issue flang-compiler/f18#661.
The issue was that when probing a specific intrinsic, the
constraints of the related generic intrinsic were tested instead
of the more restrictive constraints of the specific intrinsic.

Original-commit: flang-compiler/f18@dd971e901d
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
Tree-same-pre-rewrite: false
2019-08-23 05:03:41 -07:00
Jean Perier 8c4d2e8763 [flang] Fix SELECTED_CHAR_KIND('DEFAULT') folding issue
Fix issue flang-compiler/f18#676
The issue was that the 'DEFAULT' case was handled
directly in fold.cc which did not lowercase/trim trailing
space of the argument befaore comparing to "default".

Modify the `Selected_char_kind` function to accept the default
char kind as argument and to return it if the processed argument
matches "default".

Original-commit: flang-compiler/f18@14222ae914
Reviewed-on: https://github.com/flang-compiler/f18/pull/679
2019-08-23 03:36:29 -07:00
peter klausler 9717cc43b8 [flang] Make it easier to enable minimal FP output by default for module files (but do not enable it)
Original-commit: flang-compiler/f18@f6b640319b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
2019-08-23 11:31:47 -07:00
peter klausler b7d463f1d5 [flang] Cope better with ridiculously large exponents on input
Original-commit: flang-compiler/f18@e55cc39bad
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:47 -07:00
peter klausler 787b997830 [flang] Address most review comments
Original-commit: flang-compiler/f18@e6164782ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:46 -07:00
peter klausler 79e8749f25 [flang] Address comments, fix a bug
Original-commit: flang-compiler/f18@e095bbb23f
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:45 -07:00
peter klausler b4f34801c6 [flang] Improve comments, clean up a couple of things
Original-commit: flang-compiler/f18@8d94d643b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:43 -07:00
peter klausler 1502542fe7 [flang] Fix copyright date on new file.
Original-commit: flang-compiler/f18@60b1be7ce2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:43 -07:00
peter klausler 474c43a075 [flang] Correct header guards
Original-commit: flang-compiler/f18@77688d0392
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:40 -07:00
peter klausler bd3debe841 [flang] Reenable thorough test
Original-commit: flang-compiler/f18@431254483e
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:38 -07:00
peter klausler 28d55be08b [flang] Better unsigned division by constants
Original-commit: flang-compiler/f18@1b35c24a8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:37 -07:00
peter klausler b5408d26ed [flang] Clean up some static_casts
Original-commit: flang-compiler/f18@a5f81388a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:34 -07:00
peter klausler 3f15d46f63 [flang] Simplify guard bits (only use 3)
Original-commit: flang-compiler/f18@b710268c1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:33 -07:00
peter klausler 64a0a58bed [flang] Work around slow clang-7
Original-commit: flang-compiler/f18@ed634d72e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:32 -07:00
peter klausler b235c63caf [flang] faster Parse
Original-commit: flang-compiler/f18@ca97439c68
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:31 -07:00
peter klausler c4696eaf8e [flang] Get clean build with gcc
Original-commit: flang-compiler/f18@e6b5ed152d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:30 -07:00
peter klausler 94d8b3f25b [flang] Simplify decimal->binary
Original-commit: flang-compiler/f18@01aefbbd7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:29 -07:00
peter klausler d08c9c9d1d [flang] Make thorough test thorough again
Original-commit: flang-compiler/f18@c24b10e434
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:27 -07:00
peter klausler 95165a3921 [flang] Replace usage of original decimal conversion code with calls to new library
Original-commit: flang-compiler/f18@7a164451f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:26 -07:00
peter klausler 099838a34d [flang] Debug test
Original-commit: flang-compiler/f18@bf2c22bcf4
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:25 -07:00
peter klausler 77b3c6d53a [flang] More testing, added thorough 32-bit sweep test
Original-commit: flang-compiler/f18@f81b92f91c
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:25 -07:00
peter klausler 3863551b31 [flang] Testing & debugging
Original-commit: flang-compiler/f18@f7f933e7f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:24 -07:00
peter klausler afda616c31 [flang] Begin adding tests
Original-commit: flang-compiler/f18@8776d8b663
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:20 -07:00
peter klausler 9cdb101a4d [flang] clean up a todo
Original-commit: flang-compiler/f18@1107bd1f02
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:18 -07:00
peter klausler 93f3ae8aeb [flang] Enforce digit limits
Original-commit: flang-compiler/f18@33600e127d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:16 -07:00
peter klausler b53e09c44c [flang] Add rounding modes
Original-commit: flang-compiler/f18@9caa1a29a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:13 -07:00
peter klausler 9e26defed3 [flang] Code snapshot
Original-commit: flang-compiler/f18@46923344ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:12 -07:00
peter klausler f2cb0a8015 [flang] Move leading zero bit count into lib/common
Original-commit: flang-compiler/f18@1ed184febe
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:11 -07:00
Tim Keith a03a0432f3 [flang] Add conversions from EnumSet<Attr> to Attrs
This allows operations from EnumSet (e.g. `operator&`) to work as expected.

Original-commit: flang-compiler/f18@c8b8b742c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
2019-08-23 08:28:20 -07:00
Tim Keith 5e65aaa921 [flang] Fix .mod file bug with IMPORT of USEd name
If a symbol (derived type, for example) was use-associated into a scope
and then imported into a nested interface block, we were not including
the correct IMPORT statement in the .mod file.

This fixes refines the test for when the IMPORT is needed.

Fixes flang-compiler/f18#657.

Original-commit: flang-compiler/f18@8383de47ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Tim Keith 191a5e34b0 [flang] Fix bug in .mod file for some subprogram attributes
Some attributes for subprograms can be in the subprogram prefix but
others cannot. For the latter, emit a separate attribute statement
to specify them. We were already doing that for PRIVATE but not for
OPTIONAL. Those may be the only two attributes this can apply to.

Fixes flang-compiler/f18#659.

Original-commit: flang-compiler/f18@ae67e08780
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Tim Keith abd56ee7fd [flang] Fix writing defined operators to .mod files
When defined operators were written to .mod files in USE statement
they did not come out correctly. They have to be emitted with
`PutGenericName()` so that `operator` is included.

Original-commit: flang-compiler/f18@d40e65a2f9
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Jinxin (Brian) Yang 20eaba0392 [flang] [OpenMP] miscellaneous parse tree updates (flang-compiler/f18#673)
1. Big chunk: update comments in parse-tree.h and openmp-grammar.h
   with Spec chapter/section info, simple explanation, or productions.

2. Update `To`, `Link`, and `From` clauses with `OmpObjectList` to allow
   `/Common Block/`. Spec does not mention whether `Common Block name`
   should be accepted or not, so we should assume that these clauses
   accept normal `list-item`, which is `Variable`, `Array Section`, or
   `Common Block name`.

Original-commit: flang-compiler/f18@140315cb62
Reviewed-on: https://github.com/flang-compiler/f18/pull/673
2019-08-23 09:45:03 -07:00
Jean Perier 511cd36a58 [flang] Address comment: remove useless const
Original-commit: flang-compiler/f18@60983f5021
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
2019-08-22 01:12:20 -07:00
Jean Perier 52e72abb67 [flang] Change Scope::name() to Scope::GetName()
Address comments. Not all scopes are related to
a name. This change makes this more visible to compiler
programers by changing `scope:name()` into `Scope::GetName()`
that returns an optional `SourceName` instead of always
returning a `SourceName` and dying when it cannot.

Original-commit: flang-compiler/f18@0addb79919
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 06:29:11 -07:00
Jean Perier 281d41cc10 [flang] Use value semantic for SourceName
Change all SourceName* to std::optional<SourceName> because
SourceName is small enough (16 bytes) to be passed and stored
by value which avoid having to worry about life-time, storage and
value constance issues that comes with pointers.

Original-commit: flang-compiler/f18@73fc08d7bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 05:33:03 -07:00
Jean Perier 5cc20f6ae8 [flang] Fix test copyright year.
Original-commit: flang-compiler/f18@25819aaf7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 02:56:25 -07:00
Jean Perier f2453c9f15 [flang] Fix a crash with IMPORT in BLOCK (issue 604)
Only call scope.name() if the scope has a symbol (Block, Global,
Forall and ImpliedDo kind of scopes do not have a symbol).

Original-commit: flang-compiler/f18@81c6b67dd2
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 02:56:24 -07:00
Jinxin (Brian) Yang 5330ebbc4a [flang] [OpenMP] Canonicalization framework (flang-compiler/f18#599)
* [OpenMP] Canonicalization framework

This is mainly designed for loop association work but can be used for others,
and `CanonicalizeOmp` must be after `CanonicalizeDo`.

At the `Block` level, recognize legal sequence of `OpenMPLoopConstruct`,
`DoConstruct`, and `OmpEndLoopDirective`. Move available `DoConstruct`
and optional `OmpEndLoopDirective` into `OpenMPLoopConstruct`. Throw error
messages if:
 1. `DoConstruct` is not following `OpenMPLoopConstruct`
 2. `OmpEndLoopDirective` is not following associated do-loop

Once this pass this done, Semantics will not proceed if error exists.

* Update on reviews

1. extract matching and move part into its own function (once `DoConstruct`
   is moved, see whether `OpenMPEndLoopDirective` is available)

2. Use a template function to access construct from ExecutionPartConstruct.

3. Move this code into namespace semantics

Original-commit: flang-compiler/f18@52979f1e93
Reviewed-on: https://github.com/flang-compiler/f18/pull/599
2019-08-22 10:34:15 -07:00
Jean Perier 1bb0e9e362 [flang] Add comments and tests for issue 574 fix
Original-commit: flang-compiler/f18@89337cefc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
2019-08-21 02:42:34 -07:00
Jean Perier ccb0b48805 [flang] Handle AssocEntityDetails in mis-parsed function reference
Fix issue flang-compiler/f18#574.
Array references can be mistaken for function references during
parsing. This is handled and fixed by semantics. however, if the
symbol in the misparsed array reference was construct associated,
then semantics was not handling the case correctly because
semantics was only expecting `ObjectEntityDetails`.
It was not possible to change the related `GetUltimate` into
`GetAssociationRoot` because associated symbols are not always
associated to another symbol (variable) but may be assoicated to
an expression. Hence, this change allow `AssocEntityDetails` to
be also accepted when dealing with array references misparsed as
function references.

Original-commit: flang-compiler/f18@b6a8b5f42b
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
Tree-same-pre-rewrite: false
2019-08-20 06:15:52 -07:00
Eric Schweitz 7f2ce553e4 [flang] Add FIR dialect header
Original-commit: flang-compiler/f18@3c902e04d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
2019-08-16 19:01:49 -07:00
Eric Schweitz 9325f9974a [flang] Add mlir-tablegen for FIR ops
Original-commit: flang-compiler/f18@aae4b525da
Reviewed-on: https://github.com/flang-compiler/f18/pull/668
Tree-same-pre-rewrite: false
2019-08-16 16:14:22 -07:00
Peter Steinfeld d440b2e166 [flang] Responses to comments on the pull request:
- I removed the redundant test s3() from dosemantics90.f90
 - I changed the error messages to state "LOCAL locality-spec" rather than just
   "locality-spec"
 - I changed the names of a couple of variables/parameters in check-do.cc to
   make the code more understandable.

Original-commit: flang-compiler/f18@bcc6291e83
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
2019-08-20 15:18:37 -07:00
Peter Steinfeld 6b8a1e8248 [flang] Changes to implement constraint C1129
"C1129 A variable that is referenced by the scalar-mask-expr of a concurrent-header or by any concurrent-limit or concurrent-step in that concurrent-header shall not appear in a LOCAL locality-spec in the same DO CONCURRENT statement."

In the process of implementing these checks, I found and fixed some other problems.  I also cleaned up some of the code in check-do.cc.  I ran into two notable difficulties in implementing these checks.  First, the symbols associated with the names in a locality spec get created when the locality specs are process during name resolution.  Thus, they're different from the symbols associated with names that appear in the control expressions.  At Tim's suggestion, I dealt with this by looking up the symbols from the names in the locality spec starting with the closest enclosing scope containing the DO construct.  Second, the symbols can be hidden behind host- use- and construct-associations.

Original-commit: flang-compiler/f18@055788c2f0
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false
2019-08-20 15:18:37 -07:00
Peter Steinfeld d8c4f96f14 [flang] Clean-up of check-do.cc
I got rid of duplicate functions that test for a procedure being PURE, renamed
the type SymbolContainer to SymbolSet, and moved some functions into the class
where they're referenced.

Original-commit: flang-compiler/f18@e48bfdf573
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false
2019-08-20 15:18:37 -07:00
Jinxin (Brian) Yang ca5fee5375 [flang] [OpenMP] miscellaneous parse tree fix (flang-compiler/f18#669)
Fix `aligned(argument-list[ : alignment])` for `declare simd`

(original implementation will throw parser error if `: alignment` is present.


Original-commit: flang-compiler/f18@f3f50f9ad3
Reviewed-on: https://github.com/flang-compiler/f18/pull/669
2019-08-20 10:30:29 -07:00
Jinxin (Brian) Yang 39be4ad473 [flang] [OpenMP] parse tree fix for Declare Target (flang-compiler/f18#670)
The original implementation will throw parsing error for multiple
clauses on `declare target` directive, for example:
```
!$omp declare target to(Q) link(R)
```

Based on the OpenMP Spec, we only need two types for the specifier:

```
!$omp declare target (extended-list)
```
or
```
!$omp declare target [clause[ [,] clause] ... ]
```

This fix makes `declare target` accepts either the `list` or `clauses`,
which is more general and better for error messages.

Adjusted existing test for checking the parse tree changes. More tests
will be added during Semantics.

Original-commit: flang-compiler/f18@60f47fc1a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/670
2019-08-20 10:23:56 -07:00
Tim Keith ff768d92dd [flang] Special handling for VOLATILE and ASYNCHRONOUS
The VOLATILE and ASYNCHRONOUS attributes are special in two ways:
- they can be applied to use-associated variables
- if they are applied to a host-associated variable in a block, that
  variable has the attribute only within the scope of the block

The latter is implemented by making a new `HostAssocDetails` symbol
within the block where the attribute can be set without affecting the
variable in the outer scope. This is similar to how the SHARED locality
spec is implemented.

Fixes flang-compiler/f18#649.

Original-commit: flang-compiler/f18@471aba4513
Reviewed-on: https://github.com/flang-compiler/f18/pull/655
2019-08-13 13:50:24 -07:00
peter klausler 7749d43f3f [flang] Another pass with clean builds
Original-commit: flang-compiler/f18@e05dc1f444
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
2019-08-16 09:41:08 -07:00
peter klausler 10688e0903 [flang] Enable more warnings, deal with fallout
Original-commit: flang-compiler/f18@65c5b485af
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:07 -07:00
peter klausler e8c453f4ae [flang] Clean up all newly enabled warnings
Original-commit: flang-compiler/f18@34a917c761
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:07 -07:00
peter klausler 73632f5c36 [flang] Enable some new warnings, clean up some of their consequences
Original-commit: flang-compiler/f18@b82d1e9ac9
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:06 -07:00
Jean Perier 16b8b4cf78 [flang] Address review comments
Rename SetType to SetTypeMapping and change argumnet names.
Style changes.

Original-commit: flang-compiler/f18@3860097815
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
2019-08-14 23:55:16 -07:00
Jean Perier 0818c53966 [flang] Transform implict none ternaries to bool in ImplicitRules
Original-commit: flang-compiler/f18@324567bd2d
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Tree-same-pre-rewrite: false
2019-08-08 08:38:01 -07:00
Jean Perier 069ea6ec75 [flang] Fix IMPLICIT issue 547
So far, in `ImplicitRules` class, `isImplicitNoneType_` is a ternary
unset -> nothing about implicit in this scope, look into parents
set true -> There is an IMPLICIT NONE for types in this scope.
set to false -> There is an IMPLICIT statement mapping types in
this false.

However, it was never set to false, so the IMPORT NONE of parent scopes
was "leaking" when it should not.

Set `isImplicitNoneType_` to false if an IMPLICIT statement is met to
fix the issue.

However, this change made the current name-resolution to then completly
disregard parent scope IMPLICIT NONE even for letters for which no
mapping were defined in the current scope. To fix this `GetType` was
modified to check for implicit none.

This led to `ApplyImplicitRules` to do redudant check, so it was
reorganised to querry for a type and complain if gets a nuulptr.

`GetImplicitType` was modified to avoid redundant error message.

Original-commit: flang-compiler/f18@962dbf3d8b
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Tree-same-pre-rewrite: false
2019-08-08 07:20:12 -07:00
Steve Scalpone da480fc6ce [flang] Use ACHAR() instead of the nonstandard backslash escape sequences.
Original-commit: flang-compiler/f18@103ed895fe
Reviewed-on: https://github.com/flang-compiler/f18/pull/660
2019-08-14 10:36:29 -07:00
Steve Scalpone 7b17a67190 [flang] Define the named constants for the C characters with
special semantics in the ISO_C_BINDING intrinsic module.

Original-commit: flang-compiler/f18@bee546fdb2
Reviewed-on: https://github.com/flang-compiler/f18/pull/660
Tree-same-pre-rewrite: false
2019-08-13 20:41:43 -07:00
Jinxin (Brian) Yang bcaba6e571 [flang] [OpenMP] parse tree changes for OpenMPLoopConstruct (flang-compiler/f18#656)
1. Following Block and Sections constructs, re-structure loop related
   constructs into `{Begin, Loop, End}`. Being part of the work in
   PR flang-compiler/f18#599, the `Loop` and `End` nodes are optional during parser. They
   should be filled in during the phase of `CanonicalizationOfOmp`. This
   commit is solely for the parse tree change. So, after this commit,
   PR flang-compiler/f18#599 needs to be changed accordingly.

2. Removed parse tree nodes for `END DO` and `END DO SIMD`. Similar to
   Block and Sections constructs, `End` node now accepts clauses too,
   the validity checks are deferred into Semantics. This is more genernal
   and error message could be better.

3. With this commit alone, assertion error would occur when `End` directive
   is present, for example `!$OMP END DO` because the `End` node is not
   moved into `OpenMPLoopConstruct` yet. Again, PR flang-compiler/f18#599 will handle that.

More tests will be added in PR flang-compiler/f18#599 and during the future Semantics work.

Original-commit: flang-compiler/f18@8cd1932fd6
Reviewed-on: https://github.com/flang-compiler/f18/pull/656
2019-08-14 15:16:27 -07:00
Steve Scalpone 0653dab8de [flang] Add dcmplx to the intrinsic table and extensions documentation.
Formatting change to dimag intrinsic table entry.

Original-commit: flang-compiler/f18@7f9237531c
Reviewed-on: https://github.com/flang-compiler/f18/pull/662
2019-08-14 11:32:32 -07:00
Jinxin (Brian) Yang e59305d7ae [flang] [OpenMP] parse tree changes for Sections/Parallel Sections constructs (flang-compiler/f18#652)
```
!$omp sections [clause[ [,] clause] ... ]
[!$omp section]
structured-block
[!$omp section
structured-block]
...
!$omp end sections [nowait]
```

1. Following parse tree node changes for Block constructs, changing the
   Sections/Parallel Sections to `{Begin, Section-Blocks, End}`

2. Handles `!$omp section` in the parser, do not create parse tree node
   for this directive because basically it is a delimiter to split the
   code into different `Block`s within the Sections/Parallel Sections
   constructs. So, the `Section-Blocks` here is a `std::list` of `Block`s.
   (thanks to Tim's suggestion)

3. Modify check-omp-structure.* to avoid breaking existing tests

More tests will be added during Semantics. Also, similar to Block constructs,
the `Begin` and `End` directive matching will be done in future PR.

This commit also contains Peter's important fix for allowing "!$OMP END SECTION"
as a legal statement following `Block` (daf5630: Modify execution part error
recovery to not consume !$OMP SECTION).


Original-commit: flang-compiler/f18@75d016f6d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/652
2019-08-14 08:42:28 -07:00
Steve Scalpone 51fea2427f [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@0bbda4c39e
Reviewed-on: https://github.com/flang-compiler/f18/pull/653
2019-08-13 16:02:03 -07:00
Steve Scalpone af794f959b [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@b6c30284e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/653
Tree-same-pre-rewrite: false
2019-08-12 21:40:03 -07:00
Steve Scalpone 465393f40f [flang] Add an entry to the intrinsics table for dimag.
Also, document extensions dconjg and dimag.

Original-commit: flang-compiler/f18@21535280ee
Reviewed-on: https://github.com/flang-compiler/f18/pull/654
2019-08-13 07:36:22 -07:00
Tim Keith d151b5e88b [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@4f4caa7006
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
2019-08-13 09:15:50 -07:00
Tim Keith 47ca9b8da2 [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@b91748c053
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tree-same-pre-rewrite: false
2019-08-13 09:15:50 -07:00
Tim Keith 7fcaf88bf8 [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@5544f16348
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tree-same-pre-rewrite: false
2019-08-13 09:15:44 -07:00
Tim Keith 2bc9a1ebed [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@f6c8c58c24
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
Tree-same-pre-rewrite: false
2019-08-13 09:15:39 -07:00
Jinxin (Brian) Yang 65de6787e2 [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@9246d266b0
Reviewed-on: https://github.com/flang-compiler/f18/pull/641
2019-08-12 16:08:10 -07:00
peter klausler cbb0be6a37 [flang] Fix bug flang-compiler/f18#643
Original-commit: flang-compiler/f18@29bb4312e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/646
2019-08-12 10:56:18 -07:00
peter klausler f3b5d156cb [flang] Fix bug flang-compiler/f18#642
Original-commit: flang-compiler/f18@d898b29285
Reviewed-on: https://github.com/flang-compiler/f18/pull/648
2019-08-12 12:10:43 -07:00
peter klausler 165ab68837 [flang] Fix bug flang-compiler/f18#644, always enable backslash escapes when reading module files
Original-commit: flang-compiler/f18@f1c897ceda
Reviewed-on: https://github.com/flang-compiler/f18/pull/645
2019-08-12 10:11:59 -07:00
Peter Steinfeld 8768a11d4c [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@a8b310a968
Reviewed-on: https://github.com/flang-compiler/f18/pull/637
2019-08-09 11:38:49 -07:00
Peter Steinfeld 5bade83a0b [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@68f5acf7b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/637
Tree-same-pre-rewrite: false
2019-08-09 11:38:49 -07:00
Jinxin (Brian) Yang b41d10beae [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@e5bd6b7ba0
Reviewed-on: https://github.com/flang-compiler/f18/pull/632
2019-08-09 15:11:20 -07:00
peter klausler bc4d468d29 [flang] address comments
Original-commit: flang-compiler/f18@2bf995562c
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
2019-08-09 09:41:53 -07:00
peter klausler f13f372833 [flang] Add test for forward references in pointer initializers
Original-commit: flang-compiler/f18@9e01c102a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:52 -07:00
peter klausler e071162e04 [flang] More fixes; tests now all pass (with updates to some)
Original-commit: flang-compiler/f18@236ff3a3db
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:52 -07:00
peter klausler da6445198a [flang] rebase
Original-commit: flang-compiler/f18@a2086f0406
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:51 -07:00
peter klausler 699b499469 [flang] prep for review
Original-commit: flang-compiler/f18@41f11f4fa0
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:51 -07:00
peter klausler fca50c0822 [flang] Proper PDT handling
Original-commit: flang-compiler/f18@32256daa15
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:51 -07:00
peter klausler c9d286d6c4 [flang] Restore symbol to ProcBindingDetails
Original-commit: flang-compiler/f18@5dc1c91156
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:50 -07:00
peter klausler de7c7c07ce [flang] Save proc pointer inits in symbol table; add IsSaved() predicate to tools
Original-commit: flang-compiler/f18@23c6be9168
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:49 -07:00
peter klausler 5bfc785218 [flang] Checkpoint work
Original-commit: flang-compiler/f18@b8f614c3c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:48 -07:00
peter klausler 5045af7710 [flang] Deferred processing of pointer initializers (incomplete)
Original-commit: flang-compiler/f18@2913b01c51
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:48 -07:00
Jinxin (Brian) Yang c7fc08a8ea [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@8e2db2f868
Reviewed-on: https://github.com/flang-compiler/f18/pull/636
2019-08-09 09:39:55 -07:00
Tim Keith dd8601162b [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@2e90565675
Reviewed-on: https://github.com/flang-compiler/f18/pull/640
2019-08-08 17:05:49 -07:00
Tim Keith 57af252f56 [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@009b9ab171
Reviewed-on: https://github.com/flang-compiler/f18/pull/639
2019-08-08 16:23:53 -07:00
Jean Perier 7e197e691f [flang] Fix reabsing conflict issue
Remove duplicate `IsFunctionResultWithSameNameAsFunction` declarartion.

Original-commit: flang-compiler/f18@d88597ca72
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
2019-08-08 05:30:21 -07:00
Jean Perier 3b7b2f56d5 [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@15e3f87b40
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
Tree-same-pre-rewrite: false
2019-08-08 04:01:34 -07:00
Jean Perier 24bb2c29cd [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@2fd8b65f58
Reviewed-on: https://github.com/flang-compiler/f18/pull/631
Tree-same-pre-rewrite: false
2019-08-08 03:58:41 -07:00
Jean Perier edab0a0ebb [flang] copyright update
Original-commit: flang-compiler/f18@e724438925
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
2019-07-31 10:30:42 -07:00
Jean Perier 965d114d8c [flang] use newly added DEREF in component iterator
Original-commit: flang-compiler/f18@2185f20009
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
2019-07-31 08:56:25 -07:00
Jean Perier 153892dd66 [flang] Checkpoint: derived type component iterators
Original-commit: flang-compiler/f18@72d209bb52
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
2019-07-31 07:26:26 -07:00
Jean Perier 0a9725607b [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@4619c5860a
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
2019-07-31 07:26:24 -07:00
Jean Perier b08064ca1f [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@cbacdeaa0e
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
2019-07-31 07:26:23 -07:00
Jean Perier 06a90e3a0c [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@d84821a1d6
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
2019-07-31 07:26:18 -07:00
Jean Perier 1ac6396248 [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@b498aab15f
Reviewed-on: https://github.com/flang-compiler/f18/pull/607
Tree-same-pre-rewrite: false
2019-07-31 07:26:17 -07:00
Caroline Concatto f4a6fe026d [flang] Removing TODO comments as they are implemented by this patch
Original-commit: flang-compiler/f18@885eb92b4f
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
2019-08-07 08:48:31 +01:00
Caroline Concatto 7aaf74c1bc [flang] Removing two sentence error
Original-commit: flang-compiler/f18@fd5aafc5af
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
2019-08-06 09:26:40 +01:00
Caroline Concatto 23b0337598 [flang] Changes in SaveStmt message for Common Block name specifier
Original-commit: flang-compiler/f18@2e63705f5c
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
2019-07-23 10:36:47 +01:00
Caroline Concatto 6975bc3dd4 [flang] Changes requested by the comunity
Original-commit: flang-compiler/f18@309dd0fdfe
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
2019-07-22 15:35:51 +01:00
Caroline Concatto b8b0c82a18 [flang] Adding semantic checks for Block Construct
Original-commit: flang-compiler/f18@e626f431d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
Tree-same-pre-rewrite: false
2019-07-17 14:15:30 +01:00
Tim Keith 050a921aaf [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@0a959ce1d8
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
2019-08-07 10:51:35 -07:00
Tim Keith a5f6fa6b2e [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@4a0d0d19a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
2019-08-07 10:51:35 -07:00
Tim Keith 4887ae80cd [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@f159d97f1f
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
2019-08-07 10:51:19 -07:00
Tim Keith 331c04cce6 [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@7ef7ad6359
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
2019-08-07 10:51:07 -07:00
Tim Keith 73738d8bba [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@78c3f3b96f
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
2019-08-07 10:49:54 -07:00
Tim Keith 80678685a3 [flang] Add operator<< for parser::CharBlock
Original-commit: flang-compiler/f18@439326dc96
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
2019-08-07 10:49:54 -07:00
peter klausler 58ea24d3e3 [flang] Dodge two bogus warnings from g++ 8.1
Original-commit: flang-compiler/f18@aa19aeb92a
Reviewed-on: https://github.com/flang-compiler/f18/pull/633
2019-08-07 09:18:20 -07:00
Jean Perier 0e17c8aaac [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@bcc300e714
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
2019-08-06 04:46:20 -07:00
Jean Perier 0eafca9759 [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@57a344b256
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Tree-same-pre-rewrite: false
2019-08-06 04:46:19 -07:00
Jean Perier ba7ed2722a [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@cd5b976fc9
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Tree-same-pre-rewrite: false
2019-08-06 04:46:18 -07:00
Jinxin (Brian) Yang c4e13f6be8 [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@a77aa7ed84
Reviewed-on: https://github.com/flang-compiler/f18/pull/627
2019-08-06 11:59:40 -07:00
Peter Steinfeld c2a0096b88 [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@085b2c18f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
2019-08-05 13:37:03 -07:00
Peter Steinfeld 270ddf8436 [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@2369aa805e
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
Tree-same-pre-rewrite: false
2019-08-05 13:37:03 -07:00
Peter Steinfeld 657dc60544 [flang] Noted the constraint being tested.
Original-commit: flang-compiler/f18@471aea65d8
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
Tree-same-pre-rewrite: false
2019-08-05 13:37:02 -07:00
Jinxin (Brian) Yang deae08c21e [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@433e274f68
Reviewed-on: https://github.com/flang-compiler/f18/pull/620
2019-08-05 14:51:02 -07:00
peter klausler bef468fbfd [flang] Remove obsolete code
Original-commit: flang-compiler/f18@81a97453a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
2019-08-05 12:47:43 -07:00
peter klausler 58f93ac714 [flang] Fold SIGN()
Original-commit: flang-compiler/f18@521a02ad51
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
2019-08-05 12:44:36 -07:00
peter klausler adf204a50e [flang] Fold DIGITS
Original-commit: flang-compiler/f18@6c9adff7a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
2019-08-05 10:46:54 -07:00
peter klausler 97848749fa [flang] Add DIGITS to intrinsic function table; fix results of some others
Original-commit: flang-compiler/f18@6d5caef352
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
2019-08-05 09:42:06 -07:00
Peter Klausler f23a18c996 [flang] Update Extensions.md
Add note about type parameter declarations needing to come first in a derived type definition.

Original-commit: flang-compiler/f18@01358ac86e
Reviewed-on: https://github.com/flang-compiler/f18/pull/619
2019-08-02 15:42:54 -07:00
peter klausler c940fb6641 [flang] Fix test failure, clean up for merging
Original-commit: flang-compiler/f18@77bad27366
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
2019-08-02 10:17:10 -07:00
peter klausler 61fdf0a93e [flang] Take suggestion from review comment
Original-commit: flang-compiler/f18@7616b1f71b
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:12 -07:00
peter klausler ca57deed00 [flang] Address review comment re: ALLOCATED intrinsic argument
Original-commit: flang-compiler/f18@b24381c7df
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:11 -07:00
peter klausler 25ff9296e0 [flang] Fix LBOUND/UBOUND of associated expr, add test
Original-commit: flang-compiler/f18@009095a9bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:11 -07:00
peter klausler 6df445d0e7 [flang] Fix LBOUND & UBOUND(function()), add tests
Original-commit: flang-compiler/f18@1e093e9927
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:10 -07:00
peter klausler 63423667fe [flang] Clean up some usage of std::optional lambda results
Original-commit: flang-compiler/f18@9a66f9da97
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:09 -07:00
peter klausler 29d3343910 [flang] Extract LBOUND/UBOUND folding into their own functions
Original-commit: flang-compiler/f18@bf9146ad77
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:06 -07:00
peter klausler 16f94adf9b [flang] Address some review comments, fix crash
Original-commit: flang-compiler/f18@7b7579eb5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:04 -07:00
peter klausler 2ca6f8220c [flang] Handle association entities; fix problems found in testing
Original-commit: flang-compiler/f18@c4d9fe9587
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:03 -07:00
peter klausler 43b3e49490 [flang] Fold LBOUND and UBOUND; do not insert empty triplets into whole array expressions
Original-commit: flang-compiler/f18@82fba68a66
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:00 -07:00
peter klausler a7041f3a78 [flang] Implement GetShape with expression visitor
Original-commit: flang-compiler/f18@d607d02847
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:21:59 -07:00
Tim Keith 9764563f4d [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@95bfac6f65
Reviewed-on: https://github.com/flang-compiler/f18/pull/617
2019-08-02 09:21:34 -07:00
peter klausler d9bbf47cdc [flang] Do not inherit bindings as bare names, just components and type parameters
Original-commit: flang-compiler/f18@c4c70a6a81
Reviewed-on: https://github.com/flang-compiler/f18/pull/613
2019-08-01 15:04:27 -07:00
peter klausler 971744e106 [flang] Correct scopes of components and type parameters
Original-commit: flang-compiler/f18@6d9f85a241
Reviewed-on: https://github.com/flang-compiler/f18/pull/613
Tree-same-pre-rewrite: false
2019-08-01 15:04:25 -07:00
Jinxin (Brian) Yang cdd1ca064c [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@236cf1efea
Reviewed-on: https://github.com/flang-compiler/f18/pull/585
2019-08-01 14:32:33 -07:00
Tim Keith 723add0b8d [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@1e22970e43
Reviewed-on: https://github.com/flang-compiler/f18/pull/614
2019-08-01 13:06:25 -07:00
Tim Keith 5e39c9aa1d [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@1c32a289b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/614
Tree-same-pre-rewrite: false
2019-07-31 16:02:54 -07:00
Tim Keith ebe4ff24b4 [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@48fc076783
Reviewed-on: https://github.com/flang-compiler/f18/pull/614
Tree-same-pre-rewrite: false
2019-07-31 16:02:43 -07:00
Tim Keith 423fcec801 [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@d7aa90e55a
Reviewed-on: https://github.com/flang-compiler/f18/pull/608
2019-07-29 09:12:52 -07:00
Peter Steinfeld 177948f9f6 [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@47da8ff9c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
2019-07-25 13:37:11 -07:00
Peter Steinfeld 0904c4cfd1 [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@8a2f4bdfd2
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
Tree-same-pre-rewrite: false
2019-07-25 13:02:17 -07:00
Peter Steinfeld 814b241b45 [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@c9d2507b74
Reviewed-on: https://github.com/flang-compiler/f18/pull/596
Tree-same-pre-rewrite: false
2019-07-25 13:02:16 -07:00
peter klausler 6347b7c695 [flang] Fix bug
Original-commit: flang-compiler/f18@482f882e3f
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
2019-07-25 10:40:09 -07:00
peter klausler 5eebbe7c9b [flang] Fix IsVariable for Pete
Original-commit: flang-compiler/f18@4a24f74ae4
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
Tree-same-pre-rewrite: false
2019-07-25 10:40:07 -07:00
peter klausler 4aa659f795 [flang] Address comments; allow "real,parameter::x=tiny(x)"
Original-commit: flang-compiler/f18@e865358871
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
2019-07-25 10:16:28 -07:00
peter klausler 9b079deed5 [flang] Fold more model inquiry intrinsics
Original-commit: flang-compiler/f18@a3d82893b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
Tree-same-pre-rewrite: false
2019-07-24 14:07:03 -07:00
Jean Perier 5ab96a8604 [flang] Fix issue flang-compiler/f18#582: implicit ac-do-variable kind in expressions
Original-commit: flang-compiler/f18@4150a5e411
Reviewed-on: https://github.com/flang-compiler/f18/pull/583
2019-07-17 05:19:10 -07:00
Tim Keith 64a8b9b3d3 [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@5067345f70
Reviewed-on: https://github.com/flang-compiler/f18/pull/591
2019-07-24 06:14:42 -07:00
Jean Perier ee845d4c64 [flang] Address comment: make CHECK test more explicit
Original-commit: flang-compiler/f18@a346462676
Reviewed-on: https://github.com/flang-compiler/f18/pull/600
2019-07-24 02:06:31 -07:00
Jean Perier 8ed0f4c806 [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@5781f29ed6
Reviewed-on: https://github.com/flang-compiler/f18/pull/600
Tree-same-pre-rewrite: false
2019-07-23 08:57:40 -07:00
peter klausler ee23b2fbbd [flang] Do not remove things from .gitignore
Original-commit: flang-compiler/f18@27c896ea0b
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
2019-07-23 14:57:46 -07:00
peter klausler a65661d5e6 [flang] Review comment
Original-commit: flang-compiler/f18@784d2cc6df
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 14:07:49 -07:00
peter klausler 353202bdcf [flang] Fix handling of ALLOCATABLE components in GetLastTarget
Original-commit: flang-compiler/f18@6b3b404bdc
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 13:42:06 -07:00
peter klausler 3f753af937 [flang] Fix pointer target check
Original-commit: flang-compiler/f18@8249bc8cd4
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 12:35:56 -07:00
peter klausler 00861127ac [flang] Improve comments
Original-commit: flang-compiler/f18@277fb1cc91
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 11:45:55 -07:00
peter klausler e4945e5d09 [flang] Improve expression traversal, use it more for tools
Original-commit: flang-compiler/f18@4980b928bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 10:55:56 -07:00
peter klausler daf9eb09d4 [flang] Add root/ to .gitignore, remove old build-specific directory names
Original-commit: flang-compiler/f18@d5843aa319
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-22 14:06:06 -07:00
peter klausler 3028ecf0b8 [flang] Reimplement GetLastSymbol with expression visitor
Original-commit: flang-compiler/f18@a996751e97
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-22 14:05:33 -07:00
peter klausler 3f00257e3b [flang] Fix crash
Original-commit: flang-compiler/f18@e00864f17e
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-22 14:05:07 -07:00
jeanPerier 953d93dbe8 [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@24856b8238
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@2ec1d85d39 Implement RESHAPE folding on Constant<T> only
flang-compiler/f18@5394630539 Enable RESHAPE folding tests
flang-compiler/f18@83b2b86253 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@2e5c29f280 add missing file to previous commit...
flang-compiler/f18@9bd5ad9875 Document issue #518 workaround
flang-compiler/f18@a4f8f51831 Go back to clang-format version 7.01
flang-compiler/f18@e871e58a52 answer comment regarding naming and interface
flang-compiler/f18@145c7c1ece Merge branch 'master' into jpr-reshape-only-folding Too many logical conflicts to simply rebase.
2019-07-23 05:36:17 -07:00
peter klausler 31ffd34a02 [flang] Avoid crash on bad subscript, refactor Constant bounds a bit
Original-commit: flang-compiler/f18@c2e01e8386
Reviewed-on: https://github.com/flang-compiler/f18/pull/597
2019-07-19 16:17:07 -07:00
peter klausler 7c03f03c67 [flang] Do not add invalid subscript triple to whole assumed-size array reference
Original-commit: flang-compiler/f18@71c134a552
Reviewed-on: https://github.com/flang-compiler/f18/pull/597
Tree-same-pre-rewrite: false
2019-07-19 14:49:25 -07:00
peter klausler 978b246229 [flang] Avoid crashing in check-allocate.cc on CLASS(*)
Original-commit: flang-compiler/f18@7ba4275998
Reviewed-on: https://github.com/flang-compiler/f18/pull/595
2019-07-19 13:50:39 -07:00
Jean Perier 815cc42e9a [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@f7d124d8cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/593
2019-07-19 07:20:47 -07:00
peter klausler 645d98719d [flang] address review comment
Original-commit: flang-compiler/f18@7012b61786
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
2019-07-19 10:37:55 -07:00
peter klausler 834c4d6bc4 [flang] document a non-extension
Original-commit: flang-compiler/f18@625daf5218
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-18 15:26:17 -07:00
peter klausler 6da0d748d5 [flang] Accept NULL() in struct constructor for ALLOCATABLE component
Original-commit: flang-compiler/f18@7aee0e4852
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-18 15:08:50 -07:00
peter klausler 14f693fb94 [flang] Document intent to not support modules & programs whose names conflict with contents
Original-commit: flang-compiler/f18@e23c481911
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-18 13:57:21 -07:00
peter klausler 85db492ea0 [flang] Support SELECTED_CHAR_KIND("DEFAULT")
Original-commit: flang-compiler/f18@c05c96c474
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 15:58:28 -07:00
peter klausler 99ec2fa834 [flang] Document BOZ initializers for REAL
Original-commit: flang-compiler/f18@d72d5feb01
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 14:29:11 -07:00
peter klausler 3dbc1b7abe [flang] Allow BOZ initializers on REAL parameters, too.
Original-commit: flang-compiler/f18@e1ab6b316e
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 14:26:35 -07:00
peter klausler 8187bc12cd [flang] Silence spurious overflow warning on negative int4->int2 folding
Original-commit: flang-compiler/f18@5f1cad3911
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 14:14:09 -07:00
peter klausler 2a3f3163e6 [flang] Extension: relax "same kind" rules on some intrinsics
Original-commit: flang-compiler/f18@ce5130f84b
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 12:51:52 -07:00
peter klausler 2f49ddeefe [flang] review comment
Original-commit: flang-compiler/f18@f5c46291ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
2019-07-16 15:57:55 -07:00
peter klausler 40fb469233 [flang] Fix bug flang-compiler/f18#579 while here
Original-commit: flang-compiler/f18@eefbcdcb54
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
Tree-same-pre-rewrite: false
2019-07-16 15:57:52 -07:00
peter klausler 258e8bda21 [flang] Allow forward references to procedure interfaces in derived types (fixing flang-compiler/f18#571 more)
Original-commit: flang-compiler/f18@c1aeeae776
Reviewed-on: https://github.com/flang-compiler/f18/pull/580
Tree-same-pre-rewrite: false
2019-07-16 15:57:29 -07:00
Tim Keith 16356d58bc [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@d58bb77cfa
Reviewed-on: https://github.com/flang-compiler/f18/pull/577
2019-07-15 17:09:03 -07:00
peter klausler d3c8af484a [flang] Fix typo
Original-commit: flang-compiler/f18@f7d9f5bd7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
2019-07-16 10:53:39 -07:00
peter klausler 367d3eec60 [flang] Address review comment
Original-commit: flang-compiler/f18@5d6749c3d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:55 -07:00
peter klausler 8f40dbcd19 [flang] Fix flang-compiler/f18#571: forward reference to interface
Original-commit: flang-compiler/f18@5e00d1699c
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:53 -07:00
peter klausler 8c0aa90185 [flang] Handle USE and host associations in characteristics analysis
Original-commit: flang-compiler/f18@1625f72e35
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:51 -07:00
peter klausler 29004ece95 [flang] fix crash in ASSOCIATED() intrinsic with two arguments
Original-commit: flang-compiler/f18@1a393ff43b
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:48 -07:00
peter klausler fc638c021c [flang] Make warning about exponent letters more useful
Original-commit: flang-compiler/f18@9c9aaacd7b
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:47 -07:00
peter klausler 375dcec348 [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@9907026609
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:46 -07:00
Jean Perier 31cab04be7 [flang] Add fix for issue flang-compiler/f18#517
Original-commit: flang-compiler/f18@d9bb6890d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
2019-07-10 08:44:05 -07:00
Jean Perier 93e05161ea [flang] Answer comment: split cannondo new tests
Original-commit: flang-compiler/f18@7ebf7f72b0
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-10 03:53:25 -07:00
Jean Perier 16cf494888 [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@11e1eb6edd
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-09 11:54:40 -07:00
Jean Perier 8a4b595bf6 [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@e5ac8a1660
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-09 10:40:14 -07:00
Jean Perier 5597f366e1 [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@91cff2f296
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
2019-07-08 09:19:07 -07:00
Tim Keith 4635eb1aac [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@b62fe489be
Reviewed-on: https://github.com/flang-compiler/f18/pull/568
2019-07-12 12:37:16 -07:00
Tim Keith 97e60b7354 [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@276bb08206
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
2019-07-15 13:05:42 -07:00
peter klausler 3d8b3ddef0 [flang] Separate keyword from clauses in provenance of construct directives
Original-commit: flang-compiler/f18@9994d2351e
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
2019-07-15 13:05:30 -07:00
peter klausler ef59f7ad12 [flang] Ensure that provenance is preserved in move ctor/assignment of Verbatim
Original-commit: flang-compiler/f18@fcb5513486
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:30 -07:00
peter klausler 5557fff6e8 [flang] Complete source provenance on OMP constructs (except ATOMIC)
Original-commit: flang-compiler/f18@8f6e93d579
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:29 -07:00
peter klausler 521a9770af [flang] Combine BARRIER/TASKWAIT/TASKYIELD
Original-commit: flang-compiler/f18@c56c893a05
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:28 -07:00
peter klausler 6599bdf9b5 [flang] Convert more empty classes to enums
Original-commit: flang-compiler/f18@9cf8b9eea7
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:28 -07:00
peter klausler 2075e06dff [flang] Change more empty classes into enums
Original-commit: flang-compiler/f18@e73b0368b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:27 -07:00
peter klausler 2d0f9636a8 [flang] Change some empty classes into enums
Original-commit: flang-compiler/f18@652e474556
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:27 -07:00
peter klausler a3242b8107 [flang] more progress
Original-commit: flang-compiler/f18@1a219e5073
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:26 -07:00
peter klausler 1a26c576de [flang] Eliminate a lot of needless indirection in OMP data structures
Original-commit: flang-compiler/f18@47c6cb0ba9
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:25 -07:00
peter klausler b85df73935 [flang] Restore alphabetical order to OpenMP nodes in parse tree dumper
Original-commit: flang-compiler/f18@88b1a26035
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:24 -07:00
peter klausler 51b43e9e48 [flang] Define and use OpenMPConstructDirective
Original-commit: flang-compiler/f18@cd716fa907
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:24 -07:00
peter klausler bdec2cd8c9 [flang] Refinements; builds and passes tests again
Original-commit: flang-compiler/f18@a83410a440
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:23 -07:00
peter klausler 40c797d773 [flang] Add "..."_id token syntax for complete tokens with lookahead
Original-commit: flang-compiler/f18@19695ccfa4
Reviewed-on: https://github.com/flang-compiler/f18/pull/569
Tree-same-pre-rewrite: false
2019-07-15 13:05:22 -07:00
Tim Keith 714d3be8bf [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@2751490f95
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
2019-07-12 12:18:00 -07:00
Tim Keith 507cc50866 [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@aebb2379d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
Tree-same-pre-rewrite: false
2019-07-12 12:17:56 -07:00
peter klausler ed2213bb51 [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@7f4b4f8e74
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
2019-07-11 15:30:32 -07:00
Jinxin Yang ca3dc401a9 [flang] add ORDERED construct w/ THREADS and SIMD clauses (parse error)
Original-commit: flang-compiler/f18@23a71aed74
Reviewed-on: https://github.com/flang-compiler/f18/pull/566
Tree-same-pre-rewrite: false
2019-07-11 15:30:32 -07:00
Jinxin (Brian) Yang 800b96540b [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@75d9c1a081
Reviewed-on: https://github.com/flang-compiler/f18/pull/558
2019-07-11 15:18:09 -07:00
peter klausler 20dd13e492 [flang] Better name resolution for intrinsics
Original-commit: flang-compiler/f18@31fd9c82e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/561
2019-07-11 11:52:47 -07:00
Tim Keith cc8e1e9e9f [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@81710d4e6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
2019-07-11 08:51:40 -07:00
Tim Keith c37707a5b1 [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@48c6efbf95
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tree-same-pre-rewrite: false
2019-07-11 08:51:40 -07:00
Tim Keith ca06058da8 [flang] Fix formatting
Original-commit: flang-compiler/f18@bef7ddd43b
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tree-same-pre-rewrite: false
2019-07-11 08:51:21 -07:00
peter klausler 28f4c5ca2d [flang] Update grammar and a test in light of C1516
Original-commit: flang-compiler/f18@df4ddccde7
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
2019-07-10 16:42:10 -07:00
peter klausler f7057e031c [flang] Add -fxor-operator
Original-commit: flang-compiler/f18@b8365afc91
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:10 -07:00
peter klausler ef061f3e65 [flang] Update tests
Original-commit: flang-compiler/f18@aa18f1bca5
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:09 -07:00
peter klausler caf9e8e624 [flang] Fix name resolution with directly recursive calls.
Original-commit: flang-compiler/f18@b8e8610430
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:09 -07:00
peter klausler 2ccba3837d [flang] Do not emit PROCEDURE(TYPE(REAL)), pgf90 cannot deal. Use PROCEDURE(REAL).
Original-commit: flang-compiler/f18@ee5f392381
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:08 -07:00
peter klausler 5842409864 [flang] Document preprocessing of Fortran comments in macro actual args
Original-commit: flang-compiler/f18@f491b73636
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:07 -07:00
peter klausler 8ccd6b19c4 [flang] Allow BOZ argument to more intrinsics; generalize BOZ conversions in folding
Original-commit: flang-compiler/f18@6df0136ee8
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:06 -07:00
peter klausler b2b1f045d9 [flang] Remove reference to EUC_JP from test
Original-commit: flang-compiler/f18@ca5c812994
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:05 -07:00
peter klausler 03f5723cb6 [flang] Update extension documentation
Original-commit: flang-compiler/f18@40b44b2e3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:05 -07:00
Peter Steinfeld 542264e519 [flang] Improved warning message base on feedback from Peter.
Original-commit: flang-compiler/f18@030f364324
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
2019-07-10 12:53:56 -07:00
Peter Steinfeld 18f2628287 [flang] Changed the warning as recommended.
Original-commit: flang-compiler/f18@7887331705
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
2019-07-10 12:53:56 -07:00
Peter Steinfeld 66e8935dec [flang] Changes related to feedback from pull request flang-compiler/f18#551
- Changed the name a a function to FindOrDeclareEnclosingEntity
 - Changed that function to return a reference rather than a pointer
 - Polished the setting of the IMPLICIT flag on a declared entity in a
 locality-spec
 - Changed a test to remove an unreported error

Original-commit: flang-compiler/f18@0c1a00d7c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
2019-07-10 12:53:56 -07:00
Peter Steinfeld 2ce7432bb8 [flang] Enabling automatic declaration of names in SHARED locality-spec's
Prior to this change, the compiler issued an error message when a name in a
SHARED locality-spec had not been declared explicitly in an enclosing scope.
Presumably, this was done to enforce constraint C1124.  This constraint states
that "A variable-name in a locality-spec shall be the name of a variable in the
innermost executable construct or scoping unit that includes the DO CONCURRENT
statement".  For LOCAL and LOCAL_INIT locality-spec's, we were automatically
creating a local variable in the situation where one had not been explicitly
declared rather than issuing an error message.

The only compiler I could find that implements the SHARED locality-spec was the
PGI compiler, which automatically creates a variable and does not emit an error
message.  Also, @vdonaldson said that he had consulted with a member of the
Fortran standards committee who said that the correct thing was to create a
variable if necessary.

This change has the compiler creating a variable in the enclosing scope of a DO
CONCURRENT statement if necessary.  I also changed a test to adapt to the new
behavior.  I also consolidated the semantic checking for the constraints
associated with all of the locality-spec's.

Original-commit: flang-compiler/f18@d9253a76fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
2019-07-10 12:53:55 -07:00
Jinxin (Brian) Yang 0f8e792455 [flang] 2.8.1 SIMD structural checks (flang-compiler/f18#554)
Straightforward implementation but not including:
* list-item on aligned clause
* nesting check with the ordered construct (parse tree changes needed!)
* list-item attributes check on aligned clause

Original-commit: flang-compiler/f18@cf04d8ad26
Reviewed-on: https://github.com/flang-compiler/f18/pull/554
2019-07-09 14:08:50 -07:00
peter klausler 008e697192 [flang] Fix regressions found in testing
Original-commit: flang-compiler/f18@ea09b191df
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
2019-07-08 16:02:50 -07:00
peter klausler 644b2aabd0 [flang] Support *length character length specifiers
Original-commit: flang-compiler/f18@874b13b7d8
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 14:07:56 -07:00
peter klausler 7a6dabf974 [flang] Resolve merge
Original-commit: flang-compiler/f18@44743f1fa9
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:44:43 -07:00
peter klausler 626a4cfdfc [flang] Document non-standard use of larger INTEGER for sizes
Original-commit: flang-compiler/f18@edc79c4257
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:44:14 -07:00
peter klausler cc2172b6f4 [flang] Fix multi-file compilations in throwaway driver
Original-commit: flang-compiler/f18@7954d0aecf
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:43:42 -07:00
peter klausler e05f539917 [flang] Crash less
Original-commit: flang-compiler/f18@e8ac1a697d
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-03 16:00:26 -07:00
peter klausler d1de4fe462 [flang] Avoid null pointer dereference
Original-commit: flang-compiler/f18@3c108c0edc
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-03 16:00:25 -07:00
Tim Keith 0386490751 [flang] Prevent segfault in DynamicType::IsTkCompatibleWith
Make sure `derived_` is not null before dereferencing it.

This might only happen when there is a previous error. I saw it
compiling a test program where a USEd module was not found.

Original-commit: flang-compiler/f18@2db516556b
Reviewed-on: https://github.com/flang-compiler/f18/pull/550
2019-07-03 15:47:37 -07:00
Peter Steinfeld 5b7b8866b8 [flang] Improved the implementation of "IsCoarray()" suggested by @tskeith.
Original-commit: flang-compiler/f18@efaf5fca2e
Reviewed-on: https://github.com/flang-compiler/f18/pull/542
2019-07-03 13:59:44 -07:00
Peter Steinfeld 02a395dcb7 [flang] Changes in response to comments on pull request flang-compiler/f18#542.
Original-commit: flang-compiler/f18@e156f977d8
Reviewed-on: https://github.com/flang-compiler/f18/pull/542
Tree-same-pre-rewrite: false
2019-07-03 13:50:57 -07:00
Peter Steinfeld 84b70d8b73 [flang] Enforce constraint C1128 for DO CONCURRENT locality-spec's
These changes implement most of the requirements for C1128, which says: "A
variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not
have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of
finalizable type; shall not be a nonpointer polymorphic dummy argument; and
shall not be a coarray or an assumed-size array.  A variable-name that is not
permitted to appear in a variable definition context shall not appear in a
LOCAL or LOCAL_INIT locality-spec."

The changes do not implement the checking required to determine whether a
variable can appear in a "variable definition context".

Here's a summary of the changes:
 - I created the function 'PassesLocalityChecks()' to enforce C1128 along with
   C1124, C1125, and C1126.
 - I cleaned up the code to check if a type or symbol is a coarray.
 - I added functions to tools.[h,cc] to test if a symbol is OPTIONAL, INTENT
   IN, finalizable, a coarray, or an assumed size array.  Should these be
   member functions of the type "Symbol"?
 - Since I changed one of the locality related error messages, I needed to
   change the test resolve35.f90.
 - I added the test resolve55.f90 to test all of the checks implemented in this
   update.

Original-commit: flang-compiler/f18@4ca5d090b9
Reviewed-on: https://github.com/flang-compiler/f18/pull/542
Tree-same-pre-rewrite: false
2019-07-03 13:50:56 -07:00
Jinxin (Brian) Yang f8da811848 [flang] 2.7.1 DO: Checks about clause arguments that allow Int Expr (flang-compiler/f18#540)
All the IntExpr argument checks are done through evaluating the result of GetIntValue. If the argument is non-constant integer expr, Expression Analysis will be the gatekeeper.


Original-commit: flang-compiler/f18@d8c4804828
Reviewed-on: https://github.com/flang-compiler/f18/pull/540
2019-07-03 14:24:37 -07:00
peter klausler 24eb863fda [flang] Quick additional fix for crashes on statement functions without arguments
Original-commit: flang-compiler/f18@79779967a9
Reviewed-on: https://github.com/flang-compiler/f18/pull/548
2019-07-03 13:04:56 -07:00
peter klausler c180c0229f [flang] Trim duplicate error messages on intrinsics, and fix FINDLOC for Character data.
Original-commit: flang-compiler/f18@48ab22e213
Reviewed-on: https://github.com/flang-compiler/f18/pull/548
Tree-same-pre-rewrite: false
2019-07-03 12:30:28 -07:00
peter klausler 042298446b [flang] Graceful handling of failure in LEN() (fixes crashes)
Original-commit: flang-compiler/f18@8bab36574d
Reviewed-on: https://github.com/flang-compiler/f18/pull/545
2019-07-03 10:27:50 -07:00
peter klausler a6d02b5b55 [flang] Avoid CHECK in error recovery situation with bad array bound
Original-commit: flang-compiler/f18@d522c0da21
Reviewed-on: https://github.com/flang-compiler/f18/pull/545
Tree-same-pre-rewrite: false
2019-07-03 10:27:49 -07:00
vdonaldson a254653536 [flang] A minimal PRINT Enter function requires a minimal PRINT Leave function. (flang-compiler/f18#543)
Fixes flang-compiler/f18#541

Original-commit: flang-compiler/f18@8f3c5481e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/543
2019-07-03 09:59:59 -07:00
Tim Keith 42831fa6a9 [flang] Merge pull request flang-compiler/f18#539 from flang-compiler/tsk1
Check that procedures of a generic are distinguishable

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

Due to a conflicting rebase during the linearizing of flang-compiler/f18, this commit squashes a number of other commits:

flang-compiler/f18@9b1343af36 Some cleanup in characteristics.{h,cc}
flang-compiler/f18@ddb70e53d2 Merge branch 'master' of github.com:flang-compiler/f18 into tsk1
flang-compiler/f18@d1eef95066 Merge branch 'master' of github.com:flang-compiler/f18 into tsk1
flang-compiler/f18@24a6d3ffbf Make test_folding.sh stricter in test for warnings
flang-compiler/f18@c2c5b64060 Replace SymbolList with SymbolVector
flang-compiler/f18@c8499584df Add CopyAttrs to copy attributes from Symbol
flang-compiler/f18@0573ffd8b2 Replace cascading detailsIf calls with std::visit
flang-compiler/f18@28ec62b3ff Add name to characteristics::DummyArgument
flang-compiler/f18@568eaf0114 Add name to CopySymbol()
flang-compiler/f18@8c557b09e7 Check that procedures of a generic are distinguishable
flang-compiler/f18@50515fd987 Merge branch 'master' of github.com:flang-compiler/f18 into tsk1
flang-compiler/f18@a7963e98a4 Address review comments
flang-compiler/f18@edd65b3962 Merge branch 'master' of github.com:flang-compiler/f18 into tsk1
2019-07-02 14:00:44 -07:00
peter klausler 800138e2c2 [flang] Use enums instead of magic int values
Original-commit: flang-compiler/f18@238f84c2fb
Reviewed-on: https://github.com/flang-compiler/f18/pull/538
2019-07-02 09:16:08 -07:00
peter klausler bdcdf04431 [flang] Use LOC() in iso_c_binding for C_LOC and C_FUNLOC
Original-commit: flang-compiler/f18@da02305d1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/538
Tree-same-pre-rewrite: false
2019-07-01 16:54:53 -07:00
peter klausler c140c1e674 [flang] clean up for review
Original-commit: flang-compiler/f18@9bf94ea39c
Reviewed-on: https://github.com/flang-compiler/f18/pull/538
Tree-same-pre-rewrite: false
2019-07-01 14:00:33 -07:00
peter klausler 8e93226e74 [flang] Add LOC()/%LOC() intrinsics
Original-commit: flang-compiler/f18@3a6b90c9f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/538
Tree-same-pre-rewrite: false
2019-07-01 14:00:32 -07:00
Jinxin (Brian) Yang 1b0be3e0c9 [flang] Structural checks for DO construct (flang-compiler/f18#536)
Most restrictions in 2.7.1 Loop construct, nesting checks are still on TODO list.

seenClauses (EnumSet) is dropped. A multimap clauseInfo is added to save the encountering clause and its parser tree node pointer (parser::OmpClause) and to do the checks after walking through all the clauses.

Original-commit: flang-compiler/f18@f797357682
Reviewed-on: https://github.com/flang-compiler/f18/pull/536
2019-07-01 13:55:06 -07:00
Eric Schweitz f8cc9310c7 [flang] Fix a typo in Extract_Value description.
Original-commit: flang-compiler/f18@873a6678da
Reviewed-on: https://github.com/flang-compiler/f18/pull/537
2019-07-01 09:11:33 -07:00
peter klausler 0ae02c8630 [flang] One more
Original-commit: flang-compiler/f18@8d73b44eae
Reviewed-on: https://github.com/flang-compiler/f18/pull/535
2019-06-28 11:43:57 -07:00
peter klausler 17fdb0a0e4 [flang] Missed one
Original-commit: flang-compiler/f18@e84f4b9c7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/535
Tree-same-pre-rewrite: false
2019-06-28 11:34:15 -07:00
peter klausler dbb202c5be [flang] Extirpate NCHARACTER type, NC"" literals, and EUC-JP Hollerith
Original-commit: flang-compiler/f18@10a592a591
Reviewed-on: https://github.com/flang-compiler/f18/pull/535
Tree-same-pre-rewrite: false
2019-06-28 11:22:43 -07:00
peter klausler f937238d42 [flang] Better error reporting, with test
Original-commit: flang-compiler/f18@85e8b64d3e
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
2019-06-28 09:21:04 -07:00
peter klausler 6710f623e9 [flang] Formatting fix
Original-commit: flang-compiler/f18@e158e4f1c6
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:21:02 -07:00
peter klausler 4470eddabd [flang] Work around GCC 7.2.0 build issue
Original-commit: flang-compiler/f18@c68349f78f
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:21:00 -07:00
peter klausler 28c03d3a38 [flang] address review comments
Original-commit: flang-compiler/f18@f7188a7a33
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:20:59 -07:00
peter klausler aa67387005 [flang] delete two obsolete tests that somehow got committed
Original-commit: flang-compiler/f18@8b6a49416c
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:20:59 -07:00
peter klausler 737fe29f2b [flang] Fix regressions from testing pass
Original-commit: flang-compiler/f18@70ea3b4b09
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:20:55 -07:00
peter klausler 7d33b8529a [flang] Refine implicit typing of functions and prevent invalid conversion to objects
Original-commit: flang-compiler/f18@a90f752c20
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:20:46 -07:00
peter klausler 6c5487dfca [flang] Fix bad visitor type
Original-commit: flang-compiler/f18@968b24c033
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:55 -07:00
peter klausler ad668e1a8b [flang] Fix regression in constant array sections
Original-commit: flang-compiler/f18@595be8defa
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:52 -07:00
peter klausler e012a13a0d [flang] Make unparsing of typed Exprs conditional when unparsing to pgf90
Original-commit: flang-compiler/f18@3b79c290cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:50 -07:00
peter klausler ba780030c7 [flang] Fix function call implicit typing after recent merge
Original-commit: flang-compiler/f18@f91779c79a
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:49 -07:00
peter klausler 00e128e42a [flang] Refactor SymbolOrComponent typedef to NamedEntity class
Original-commit: flang-compiler/f18@e8ec4b88bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:47 -07:00
peter klausler b5fa75763e [flang] work around bad module file output for visibility attrs on subprograms
Original-commit: flang-compiler/f18@0970cccc4e
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:47 -07:00
peter klausler 98e3113206 [flang] Better initialization support
Original-commit: flang-compiler/f18@ff2f26fe7b
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:46 -07:00
peter klausler d7eb8c441f [flang] Support lower bounds in constants
Original-commit: flang-compiler/f18@d5269cd5a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:46 -07:00
peter klausler b079ed65a3 [flang] Back out bad commit of f18 module files
Original-commit: flang-compiler/f18@230117c437
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:45 -07:00
peter klausler f7c34914de [flang] Add LOGICAL8, &c.
Original-commit: flang-compiler/f18@fd8df8cd8f
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:44 -07:00
peter klausler c2b743122a [flang] GetBaseObject()
Original-commit: flang-compiler/f18@38eced54de
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:44 -07:00
peter klausler f01537b146 [flang] IsInitialDataTarget()
Original-commit: flang-compiler/f18@c005e14de9
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:43 -07:00
peter klausler 56a1941f7f [flang] More extension names
Original-commit: flang-compiler/f18@f30d4cf73d
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:43 -07:00
peter klausler b6eb421e13 [flang] Fix pointer initializer
Original-commit: flang-compiler/f18@4b2af83a75
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:42 -07:00
peter klausler a53b11c92d [flang] Support anonymous parent components in struct const
Original-commit: flang-compiler/f18@b28b9932b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:41 -07:00
peter klausler c4f0ea5a14 [flang] Pass PGF90 options on only if underlying compiler is PGF90
Original-commit: flang-compiler/f18@dc34f75b07
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:40 -07:00