Commit graph

2199 commits

Author SHA1 Message Date
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
Steve Scalpone 56eb30bb86 [flang] Merge pull request flang-compiler/f18#584 from CarolineConcatto/block_construct_patch
Adding semantic checks for Block Construct

Original-commit: flang-compiler/f18@47781549a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/584
2019-08-07 11:52:11 -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 00b5ab683f [flang] Merge pull request flang-compiler/f18#630 from flang-compiler/tsk-array-spec
Perform more checks on array-specs

Original-commit: flang-compiler/f18@14a38209a9
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
2019-08-07 11:18:50 -07: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 d1d63f3646 [flang] Merge pull request flang-compiler/f18#633 from flang-compiler/pmk-warnings
Dodge two bogus warnings from g++ 8.1

Original-commit: flang-compiler/f18@2aa98a9d4d
Reviewed-on: https://github.com/flang-compiler/f18/pull/633
2019-08-07 10:41:39 -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
jeanPerier 180ba3354b [flang] Merge pull request flang-compiler/f18#615 from flang-compiler/jpr-fix-581
Fix issue 581: extended derived type kind parameter comparison 

Original-commit: flang-compiler/f18@4670ae020b
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
2019-08-07 03:39:52 -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
psteinfeld fb30d812e7 [flang] Merge pull request flang-compiler/f18#612 from flang-compiler/ps-c1130
Changes to enforce constraint C1130

Original-commit: flang-compiler/f18@88af7ce563
Reviewed-on: https://github.com/flang-compiler/f18/pull/612
2019-08-06 10:20:22 -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 bd723f22d0 [flang] Merge pull request flang-compiler/f18#623 from flang-compiler/pmk-fixes
Implement features to resolve bugs flang-compiler/f18#621 and flang-compiler/f18#622

Original-commit: flang-compiler/f18@2cd989479c
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
2019-08-05 13:19:29 -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 43b5fc77ba [flang] Merge pull request flang-compiler/f18#619 from flang-compiler/klausler-patch-1
Update Extensions.md

Original-commit: flang-compiler/f18@6e4f320aeb
Reviewed-on: https://github.com/flang-compiler/f18/pull/619
2019-08-02 16:52:57 -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 b40ee46b00 [flang] Merge pull request flang-compiler/f18#611 from flang-compiler/pmk-bounds
Fold LBOUND and UBOUND intrinsic functions

Original-commit: flang-compiler/f18@46d77ab006
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
2019-08-02 11:15:24 -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 b72ef0b370 [flang] Merge pull request flang-compiler/f18#617 from flang-compiler/tsk-issue616
Fix bug with use-associated base of component reference

Original-commit: flang-compiler/f18@ded6d831ee
Reviewed-on: https://github.com/flang-compiler/f18/pull/617
2019-08-02 10:20:14 -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 f812a7d7f1 [flang] Merge pull request flang-compiler/f18#613 from flang-compiler/pmk-component-scope
Correct scopes of components

Original-commit: flang-compiler/f18@00bdacd6d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/613
2019-08-02 09:20:50 -07:00