platform/upstream/llvm.git
4 years ago[flang] Enforce digit limits
peter klausler [Wed, 14 Aug 2019 20:10:10 +0000 (13:10 -0700)]
[flang] Enforce digit limits

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

4 years ago[flang] Add rounding modes
peter klausler [Wed, 14 Aug 2019 18:53:04 +0000 (11:53 -0700)]
[flang] Add rounding modes

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

4 years ago[flang] Code snapshot
peter klausler [Tue, 13 Aug 2019 23:28:05 +0000 (16:28 -0700)]
[flang] Code snapshot

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

4 years ago[flang] Move leading zero bit count into lib/common
peter klausler [Thu, 25 Jul 2019 17:31:53 +0000 (10:31 -0700)]
[flang] Move leading zero bit count into lib/common

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

4 years ago[flang] Merge pull request flang-compiler/f18#675 from flang-compiler/tsk-modfiles2
Tim Keith [Fri, 23 Aug 2019 18:28:33 +0000 (11:28 -0700)]
[flang] Merge pull request flang-compiler/f18#675 from flang-compiler/tsk-modfiles2

Fix bugs in .mod file generation

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

4 years ago[flang] Add conversions from EnumSet<Attr> to Attrs
Tim Keith [Fri, 23 Aug 2019 15:28:20 +0000 (08:28 -0700)]
[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@c8b8b742c8cbc675c5e60e8c96533ef36bbbb448
Reviewed-on: https://github.com/flang-compiler/f18/pull/675

4 years ago[flang] Fix .mod file bug with IMPORT of USEd name
Tim Keith [Thu, 22 Aug 2019 20:57:18 +0000 (13:57 -0700)]
[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@8383de47ecb1b6901e2dd6f290df28fe8a470908
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false

4 years ago[flang] Fix bug in .mod file for some subprogram attributes
Tim Keith [Tue, 20 Aug 2019 21:49:37 +0000 (14:49 -0700)]
[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@ae67e087800c5aecb8cb2d2aea16d19b8cc8ccf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false

4 years ago[flang] Fix writing defined operators to .mod files
Tim Keith [Tue, 20 Aug 2019 19:05:44 +0000 (12:05 -0700)]
[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@d40e65a2f9c176f5334adb8132ef65273cf3615f
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false

4 years ago[flang] [OpenMP] miscellaneous parse tree updates (flang-compiler/f18#673)
Jinxin (Brian) Yang [Fri, 23 Aug 2019 16:45:03 +0000 (09:45 -0700)]
[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@140315cb62da295f6306c2afc737041fa1626dff
Reviewed-on: https://github.com/flang-compiler/f18/pull/673

4 years ago[flang] Merge pull request flang-compiler/f18#634 from flang-compiler/jpr-fix-604
jeanPerier [Fri, 23 Aug 2019 09:19:36 +0000 (02:19 -0700)]
[flang] Merge pull request flang-compiler/f18#634 from flang-compiler/jpr-fix-604

Fix a crash with IMPORT in BLOCK (issue 604)

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

4 years ago[flang] Address comment: remove useless const
Jean Perier [Thu, 22 Aug 2019 08:12:20 +0000 (01:12 -0700)]
[flang] Address comment: remove useless const

Original-commit: flang-compiler/f18@60983f502103575999a91bf62cd0c78aded85837
Reviewed-on: https://github.com/flang-compiler/f18/pull/634

5 years ago[flang] Change Scope::name() to Scope::GetName()
Jean Perier [Wed, 21 Aug 2019 13:29:11 +0000 (06:29 -0700)]
[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@0addb79919f69a6530b0919356a24e68f21507c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false

5 years ago[flang] Use value semantic for SourceName
Jean Perier [Wed, 21 Aug 2019 12:33:03 +0000 (05:33 -0700)]
[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@73fc08d7bd956b1b793f8930164f9b4ebb7e279c
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false

5 years ago[flang] Fix test copyright year.
Jean Perier [Wed, 7 Aug 2019 17:18:30 +0000 (10:18 -0700)]
[flang] Fix test copyright year.

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

5 years ago[flang] Fix a crash with IMPORT in BLOCK (issue 604)
Jean Perier [Wed, 7 Aug 2019 17:14:28 +0000 (10:14 -0700)]
[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@81c6b67dd2cbb926aba967d9ce2b8973355ca737
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false

4 years ago[flang] [OpenMP] Canonicalization framework (flang-compiler/f18#599)
Jinxin (Brian) Yang [Thu, 22 Aug 2019 17:34:15 +0000 (10:34 -0700)]
[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@52979f1e93f40c31e04118067403a258555d139a
Reviewed-on: https://github.com/flang-compiler/f18/pull/599

4 years ago[flang] Merge pull request flang-compiler/f18#672 from flang-compiler/jpr-fix-574
jeanPerier [Thu, 22 Aug 2019 12:49:15 +0000 (05:49 -0700)]
[flang] Merge pull request flang-compiler/f18#672 from flang-compiler/jpr-fix-574

 Handle AssocEntityDetails in mis-parsed function reference

Original-commit: flang-compiler/f18@0006272bbd79f1d4073d52516e0672911108138a
Reviewed-on: https://github.com/flang-compiler/f18/pull/672

5 years ago[flang] Add comments and tests for issue 574 fix
Jean Perier [Wed, 21 Aug 2019 09:42:34 +0000 (02:42 -0700)]
[flang] Add comments and tests for issue 574 fix

Original-commit: flang-compiler/f18@89337cefc7f22944ab53347f97261cb6038a628f
Reviewed-on: https://github.com/flang-compiler/f18/pull/672

5 years ago[flang] Handle AssocEntityDetails in mis-parsed function reference
Jean Perier [Tue, 20 Aug 2019 13:15:52 +0000 (06:15 -0700)]
[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@b6a8b5f42bdb40d65f4c242a3673bc436a2d0601
Reviewed-on: https://github.com/flang-compiler/f18/pull/672
Tree-same-pre-rewrite: false

4 years ago[flang] Merge pull request flang-compiler/f18#668 from schweitzpgi/master
Eric Schweitz [Wed, 21 Aug 2019 18:21:01 +0000 (11:21 -0700)]
[flang] Merge pull request flang-compiler/f18#668 from schweitzpgi/master

Add mlir-tablegen for FIR ops

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

5 years ago[flang] Add FIR dialect header
Eric Schweitz [Sat, 17 Aug 2019 02:01:49 +0000 (19:01 -0700)]
[flang] Add FIR dialect header

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

5 years ago[flang] Add mlir-tablegen for FIR ops
Eric Schweitz [Fri, 16 Aug 2019 23:14:22 +0000 (16:14 -0700)]
[flang] Add mlir-tablegen for FIR ops

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

5 years ago[flang] Merge pull request flang-compiler/f18#663 from flang-compiler/ps-c1129
psteinfeld [Wed, 21 Aug 2019 04:08:04 +0000 (21:08 -0700)]
[flang] Merge pull request flang-compiler/f18#663 from flang-compiler/ps-c1129

Checks for constraint C1129

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

5 years ago[flang] Responses to comments on the pull request:
Peter Steinfeld [Tue, 20 Aug 2019 22:17:51 +0000 (15:17 -0700)]
[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@bcc6291e8370d97cb3d4c23a30e676bf3a0012ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/663

5 years ago[flang] Changes to implement constraint C1129
Peter Steinfeld [Wed, 14 Aug 2019 19:57:09 +0000 (12:57 -0700)]
[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@055788c2f0604c5bd37637732aec863f8e3aebf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false

5 years ago[flang] Clean-up of check-do.cc
Peter Steinfeld [Thu, 8 Aug 2019 22:54:49 +0000 (15:54 -0700)]
[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@e48bfdf5737d102b2fa8faedb0f002faf5f30a7e
Reviewed-on: https://github.com/flang-compiler/f18/pull/663
Tree-same-pre-rewrite: false

5 years ago[flang] [OpenMP] miscellaneous parse tree fix (flang-compiler/f18#669)
Jinxin (Brian) Yang [Tue, 20 Aug 2019 17:30:29 +0000 (10:30 -0700)]
[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@f3f50f9ad3b77174d0054011a17c8e4d3af50d98
Reviewed-on: https://github.com/flang-compiler/f18/pull/669

5 years ago[flang] [OpenMP] parse tree fix for `Declare Target` (flang-compiler/f18#670)
Jinxin (Brian) Yang [Tue, 20 Aug 2019 17:23:56 +0000 (10:23 -0700)]
[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@60f47fc1a15803001d9251d8d8e3c53cf979ccc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/670

5 years ago[flang] Merge pull request flang-compiler/f18#655 from flang-compiler/tsk-issue649
Tim Keith [Tue, 20 Aug 2019 14:38:04 +0000 (07:38 -0700)]
[flang] Merge pull request flang-compiler/f18#655 from flang-compiler/tsk-issue649

Special handling for VOLATILE and ASYNCHRONOUS

Original-commit: flang-compiler/f18@75a57c59d244303844291f990f9487a69f290b73
Reviewed-on: https://github.com/flang-compiler/f18/pull/655

5 years ago[flang] Special handling for VOLATILE and ASYNCHRONOUS
Tim Keith [Tue, 13 Aug 2019 20:50:24 +0000 (13:50 -0700)]
[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@471aba451341a65ff6014bbe30cb2c64cf905da6
Reviewed-on: https://github.com/flang-compiler/f18/pull/655

5 years ago[flang] Merge pull request flang-compiler/f18#666 from flang-compiler/pmk-warnings
Peter Klausler [Fri, 16 Aug 2019 18:03:17 +0000 (11:03 -0700)]
[flang] Merge pull request flang-compiler/f18#666 from flang-compiler/pmk-warnings

Fix bug flang-compiler/f18#665, enable more warnings, deal with fallout

Original-commit: flang-compiler/f18@5762c2d88bd6844895bccf1226fd6301721a98c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/666

5 years ago[flang] Another pass with clean builds
peter klausler [Thu, 15 Aug 2019 21:25:05 +0000 (14:25 -0700)]
[flang] Another pass with clean builds

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

5 years ago[flang] Enable more warnings, deal with fallout
peter klausler [Thu, 15 Aug 2019 20:50:27 +0000 (13:50 -0700)]
[flang] Enable more warnings, deal with fallout

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

5 years ago[flang] Clean up all newly enabled warnings
peter klausler [Thu, 15 Aug 2019 18:54:51 +0000 (11:54 -0700)]
[flang] Clean up all newly enabled warnings

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

5 years ago[flang] Enable some new warnings, clean up some of their consequences
peter klausler [Thu, 15 Aug 2019 17:17:31 +0000 (10:17 -0700)]
[flang] Enable some new warnings, clean up some of their consequences

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

5 years ago[flang] Merge pull request flang-compiler/f18#635 from flang-compiler/jpr-fix-547
jeanPerier [Fri, 16 Aug 2019 08:03:19 +0000 (01:03 -0700)]
[flang] Merge pull request flang-compiler/f18#635 from flang-compiler/jpr-fix-547

Fix IMPLICIT issue 547

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

5 years ago[flang] Address review comments
Jean Perier [Thu, 15 Aug 2019 06:55:16 +0000 (23:55 -0700)]
[flang] Address review comments
Rename SetType to SetTypeMapping and change argumnet names.
Style changes.

Original-commit: flang-compiler/f18@3860097815fd4e20c8c81f809c9891e163678c6a
Reviewed-on: https://github.com/flang-compiler/f18/pull/635

5 years ago[flang] Transform implict none ternaries to bool in `ImplicitRules`
Jean Perier [Thu, 8 Aug 2019 15:38:01 +0000 (08:38 -0700)]
[flang] Transform implict none ternaries to bool in `ImplicitRules`

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

5 years ago[flang] Fix IMPLICIT issue 547
Jean Perier [Thu, 8 Aug 2019 14:20:12 +0000 (07:20 -0700)]
[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@962dbf3d8be5dc1a6780544bf1be5a803b6d7724
Reviewed-on: https://github.com/flang-compiler/f18/pull/635
Tree-same-pre-rewrite: false

5 years ago[flang] Merge pull request flang-compiler/f18#660 from flang-compiler/sjs-c-chars
Steve Scalpone [Thu, 15 Aug 2019 21:54:05 +0000 (14:54 -0700)]
[flang] Merge pull request flang-compiler/f18#660 from flang-compiler/sjs-c-chars

Define the named constants for the C characters with special semantics

Original-commit: flang-compiler/f18@9c4ce244ad0447b923964431cf3b9f772fa03af0
Reviewed-on: https://github.com/flang-compiler/f18/pull/660

5 years ago[flang] Use ACHAR() instead of the nonstandard backslash escape sequences.
Steve Scalpone [Wed, 14 Aug 2019 17:36:29 +0000 (10:36 -0700)]
[flang] Use ACHAR() instead of the nonstandard backslash escape sequences.

Original-commit: flang-compiler/f18@103ed895fe27ae0f4503a4cf379132392dc14788
Reviewed-on: https://github.com/flang-compiler/f18/pull/660

5 years ago[flang] Define the named constants for the C characters with
Steve Scalpone [Wed, 14 Aug 2019 03:41:43 +0000 (20:41 -0700)]
[flang] Define the named constants for the C characters with
special semantics in the ISO_C_BINDING intrinsic module.

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

5 years ago[flang] [OpenMP] parse tree changes for `OpenMPLoopConstruct` (flang-compiler/f18...
Jinxin (Brian) Yang [Wed, 14 Aug 2019 22:16:27 +0000 (15:16 -0700)]
[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@8cd1932fd61fa67f8ad5abfd337cf7a223ea89f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/656

5 years ago[flang] Merge pull request flang-compiler/f18#662 from flang-compiler/sjs-dcmplx
Steve Scalpone [Wed, 14 Aug 2019 19:21:43 +0000 (20:21 +0100)]
[flang] Merge pull request flang-compiler/f18#662 from flang-compiler/sjs-dcmplx

Add dcmplx to the intrinsic table and extensions documentation.

Original-commit: flang-compiler/f18@8e0c2dea823c3e41324aabc6b2755d373d51a955
Reviewed-on: https://github.com/flang-compiler/f18/pull/662

5 years ago[flang] Add dcmplx to the intrinsic table and extensions documentation.
Steve Scalpone [Wed, 14 Aug 2019 18:32:32 +0000 (11:32 -0700)]
[flang] Add dcmplx to the intrinsic table and extensions documentation.
Formatting change to dimag intrinsic table entry.

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

5 years ago[flang] [OpenMP] parse tree changes for Sections/Parallel Sections constructs (flang...
Jinxin (Brian) Yang [Wed, 14 Aug 2019 15:42:28 +0000 (08:42 -0700)]
[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@75d016f6d27e73f5d559fe68d8a01df251c6d8cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/652

5 years ago[flang] Merge pull request flang-compiler/f18#653 from flang-compiler/sjs-throwaway...
Steve Scalpone [Wed, 14 Aug 2019 01:29:40 +0000 (02:29 +0100)]
[flang] Merge pull request flang-compiler/f18#653 from flang-compiler/sjs-throwaway-wrapper2

Create a throwaway wrapper for the throwaway driver.

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

5 years ago[flang] Change the suffix of the module files to be .f18.mod
Steve Scalpone [Tue, 13 Aug 2019 23:02:03 +0000 (16:02 -0700)]
[flang] Change the suffix of the module files to be .f18.mod
so makefiles with "rm *.mod" will still work. Add a
new option to f18, -intrinsic-module-directory, which
supplies a directory in which f18 searches for standard
intrinsic modules. Neither the option nor the path is passed to F18_FC.

Original-commit: flang-compiler/f18@0bbda4c39edf170d3c194e4ad16b07e88995e46c
Reviewed-on: https://github.com/flang-compiler/f18/pull/653

5 years ago[flang] Create a throwaway wrapper for the throwaway driver.
Steve Scalpone [Tue, 13 Aug 2019 04:40:03 +0000 (21:40 -0700)]
[flang] Create a throwaway wrapper for the throwaway driver.
Add a script called flang to the bin directory that calls
f18 with the -I option pointing to the module files for the
predefined modules. The wrapper also sets the module suffix
to .fmf to avoid naming conflicts with module files generated
by other compilers. Now, the build creates and installs both
.mod and .fmf files for the predefined module files to
accommodate the flang script.

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

5 years ago[flang] Merge pull request flang-compiler/f18#654 from flang-compiler/sjs-dimag
Steve Scalpone [Tue, 13 Aug 2019 16:53:33 +0000 (17:53 +0100)]
[flang] Merge pull request flang-compiler/f18#654 from flang-compiler/sjs-dimag

Add an entry to the intrinsics table for dimag.

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

5 years ago[flang] Add an entry to the intrinsics table for dimag.
Steve Scalpone [Tue, 13 Aug 2019 14:31:50 +0000 (07:31 -0700)]
[flang] Add an entry to the intrinsics table for dimag.
Also, document extensions dconjg and dimag.

Original-commit: flang-compiler/f18@21535280ee2c3ed7e0e33b70be3fcd844ab5f541
Reviewed-on: https://github.com/flang-compiler/f18/pull/654

5 years ago[flang] Merge pull request flang-compiler/f18#650 from flang-compiler/tsk-modfiles
Tim Keith [Tue, 13 Aug 2019 16:52:04 +0000 (09:52 -0700)]
[flang] Merge pull request flang-compiler/f18#650 from flang-compiler/tsk-modfiles

Fix bugs writing .mod files

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

5 years ago[flang] Fix bug writing character array constructor to .mod file
Tim Keith [Mon, 12 Aug 2019 22:29:58 +0000 (15:29 -0700)]
[flang] Fix bug writing character array constructor to .mod file

Character literals in an array constructor were always written
with no kind prefix, so if kind was not 1 they were incorrect.
`c4a` in `modfile28.f90` was an example of this.

Change it to always include the kind as is done with non-array
character literals.

Original-commit: flang-compiler/f18@4f4caa700639b87503729f69f13d5e0ec0e20583
Reviewed-on: https://github.com/flang-compiler/f18/pull/650

5 years ago[flang] Small .mod file fixes
Tim Keith [Mon, 12 Aug 2019 21:06:06 +0000 (14:06 -0700)]
[flang] Small .mod file fixes

- Only emit initializations for parameters and derived type components.
- Use `=>` for pointer initializations.
- Don't emit intrinsic symbols.

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

5 years ago[flang] Fix source location of some symbol names
Tim Keith [Mon, 12 Aug 2019 20:50:45 +0000 (13:50 -0700)]
[flang] Fix source location of some symbol names

Symbols can be declared across multiple statements. The CharBlock
that is used for the symbol name is from the first of these.

Sometimes that is not the best choice. If a name appears in a
type-declaration-stmt or a derived-type-stmt, that occurrence is a
better choice. Errors referencing that symbol should normally point
at that name (not its appearance in an earlier PUBLIC statement,
for example).

Also, the order of symbols in .mod files is based on the order of
their names in the cooked source. Here is an example where it is
necessary to sort `a` based on where its type-declaration-stmt
occurs rather than the first occurrence of `a`:
```
  public :: a
  type t
  end type
  type(t), parameter :: a = t()
```

The fix is to add `Symbol::ReplaceName()` so that we can update the
CharBlock for a symbol name when a better one is found, without
changing the actual characters that make up the name.

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

5 years ago[flang] Write function result to .mod file after dummy args
Tim Keith [Mon, 12 Aug 2019 20:06:59 +0000 (13:06 -0700)]
[flang] Write function result to .mod file after dummy args

The function result can depend on the declaration of the dummy
arguments so it should be written to the .mod file after them.

For example:
```
  function f(x)
    integer :: x(:)
    integer :: f(size(x))
  end
```

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

5 years ago[flang] [OpenMP] parse tree changes for Critical Construct (flang-compiler/f18#641)
Jinxin (Brian) Yang [Mon, 12 Aug 2019 23:08:10 +0000 (16:08 -0700)]
[flang] [OpenMP] parse tree changes for Critical Construct (flang-compiler/f18#641)

Simple changes: add source provenance for directive itself and renaming

Original-commit: flang-compiler/f18@9246d266b0b5854db4f1f8beaf47cac80fcf7f0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/641

5 years ago[flang] Merge pull request flang-compiler/f18#646 from flang-compiler/pmk-fix-643
Peter Klausler [Mon, 12 Aug 2019 23:04:24 +0000 (16:04 -0700)]
[flang] Merge pull request flang-compiler/f18#646 from flang-compiler/pmk-fix-643

Fix bug flang-compiler/f18#643

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

5 years ago[flang] Fix bug flang-compiler/f18#643
peter klausler [Mon, 12 Aug 2019 17:56:18 +0000 (10:56 -0700)]
[flang] Fix bug flang-compiler/f18#643

Original-commit: flang-compiler/f18@29bb4312e1f2861fa04f847c8e552ca894989593
Reviewed-on: https://github.com/flang-compiler/f18/pull/646

5 years ago[flang] Merge pull request flang-compiler/f18#648 from flang-compiler/pmk-fix-642
Peter Klausler [Mon, 12 Aug 2019 19:29:51 +0000 (12:29 -0700)]
[flang] Merge pull request flang-compiler/f18#648 from flang-compiler/pmk-fix-642

Fix bug flang-compiler/f18#642

Original-commit: flang-compiler/f18@319c083673ca135d375e4977e6cedd4133c4bdf5
Reviewed-on: https://github.com/flang-compiler/f18/pull/648

5 years ago[flang] Fix bug flang-compiler/f18#642
peter klausler [Mon, 12 Aug 2019 19:10:43 +0000 (12:10 -0700)]
[flang] Fix bug flang-compiler/f18#642

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

5 years ago[flang] Merge pull request flang-compiler/f18#645 from flang-compiler/pmk-fix-644
Peter Klausler [Mon, 12 Aug 2019 17:31:53 +0000 (10:31 -0700)]
[flang] Merge pull request flang-compiler/f18#645 from flang-compiler/pmk-fix-644

Fix bug flang-compiler/f18#644, always enable backslash escapes when reading module files

Original-commit: flang-compiler/f18@4ade6c36755fbf343af1db6e657fb5de6eb49ec4
Reviewed-on: https://github.com/flang-compiler/f18/pull/645

5 years ago[flang] Fix bug flang-compiler/f18#644, always enable backslash escapes when reading...
peter klausler [Mon, 12 Aug 2019 17:11:59 +0000 (10:11 -0700)]
[flang] Fix bug flang-compiler/f18#644, always enable backslash escapes when reading module files

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

5 years ago[flang] Merge pull request flang-compiler/f18#637 from flang-compiler/ps-do-tests
psteinfeld [Sat, 10 Aug 2019 15:18:51 +0000 (08:18 -0700)]
[flang] Merge pull request flang-compiler/f18#637 from flang-compiler/ps-do-tests

Tests for DO loop semantics

Original-commit: flang-compiler/f18@960d76131e46ccb2ff704ab2bdbc070dff8cd279
Reviewed-on: https://github.com/flang-compiler/f18/pull/637

5 years ago[flang] - ieee_exceptions.f90: I added all of the routines listed in table 17.3...
Peter Steinfeld [Fri, 9 Aug 2019 18:34:31 +0000 (11:34 -0700)]
[flang]  - ieee_exceptions.f90: I added all of the routines listed in table 17.3 of the standard that were not currently specified.  I also re-ordered the routines to be in the same order as the standard.
 - doconcurrent01.f90: I removed the custom versions of ieee_exceptions and
 iso_fortran_env.  I also fixed a typo in a comment.  Also, the use of the real
 standare interface caused one of the error messages to go away, so I fixed
 that.

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

5 years ago[flang] Tests for DO loop semantics
Peter Steinfeld [Thu, 8 Aug 2019 20:28:50 +0000 (13:28 -0700)]
[flang] Tests for DO loop semantics
These are tests for checks that are already implemented, but for which we
did not have tests.

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

5 years ago[flang] [OpenMP] parse tree changes for `OpenMPBlockConstruct` (flang-compiler/f18...
Jinxin (Brian) Yang [Fri, 9 Aug 2019 22:11:20 +0000 (15:11 -0700)]
[flang] [OpenMP] parse tree changes for `OpenMPBlockConstruct` (flang-compiler/f18#632)

* [OpenMP] parse tree changes for `OpenMPBlockConstruct`

1. merge `Workshare` and `Single` into `OpenMPBlockConstruct` because
   they both accept structured-block and syntax is similar to other block
   directives.

2. `OpenMPBlockConstruct` changes to structure like `{Begin, Block, End}`,
   where `Begin` and `End` are tuple of `{Directive, ClauseList}`.

3. Updated the check-omp-structure.* for necessary parts. Added all the END
   directive enumeration types that may have clauses.

More tests will be added during Semantics.

* [OpenMP] Update on Tim's suggestion

1. Fix unspecified enumeration for `OmpDirective` in the `OmpContext`.
   This is through getting rid of `PushContext(source)` function to
   make sure whenever it is about to push a NEW context, directive
   source location and enumeration are available. To do that, I moved
   around all the switches for directive into high level `Construct`'s
   `Enter` node. Besides fixing the issue, the side benefit is that
   whenever we call `GetContext().directive`, we are sure that the
   `directive` here was set already.

2. When `Enter` the `OmpEndBlockDirective` node, partial context
   information, such as directive source location or legal clause lists,
   needs to be reset. The new directive source location should be
   `OmpEndBlockDirective`'s `source`. The enumeration `directive`
   should not be reset for the END directives that do not accept
   clauses because nothing needs to be checked (for example any clause
   that is on `END PARALLEL` is illegal).

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

5 years ago[flang] Merge pull request flang-compiler/f18#638 from flang-compiler/pmk-forward
Peter Klausler [Fri, 9 Aug 2019 19:15:27 +0000 (12:15 -0700)]
[flang] Merge pull request flang-compiler/f18#638 from flang-compiler/pmk-forward

Handle forward references to procedures and interfaces

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

5 years ago[flang] address comments
peter klausler [Fri, 9 Aug 2019 16:38:21 +0000 (09:38 -0700)]
[flang] address comments

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

5 years ago[flang] Add test for forward references in pointer initializers
peter klausler [Thu, 8 Aug 2019 22:15:01 +0000 (15:15 -0700)]
[flang] Add test for forward references in pointer initializers

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

5 years ago[flang] More fixes; tests now all pass (with updates to some)
peter klausler [Thu, 8 Aug 2019 22:06:51 +0000 (15:06 -0700)]
[flang] More fixes; tests now all pass (with updates to some)

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

5 years ago[flang] rebase
peter klausler [Thu, 8 Aug 2019 17:50:23 +0000 (10:50 -0700)]
[flang] rebase

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

5 years ago[flang] prep for review
peter klausler [Thu, 8 Aug 2019 17:13:33 +0000 (10:13 -0700)]
[flang] prep for review

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

5 years ago[flang] Proper PDT handling
peter klausler [Thu, 8 Aug 2019 00:10:43 +0000 (17:10 -0700)]
[flang] Proper PDT handling

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

5 years ago[flang] Restore symbol to ProcBindingDetails
peter klausler [Wed, 7 Aug 2019 21:45:44 +0000 (14:45 -0700)]
[flang] Restore symbol to ProcBindingDetails

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

5 years ago[flang] Save proc pointer inits in symbol table; add IsSaved() predicate to tools
peter klausler [Tue, 6 Aug 2019 18:49:47 +0000 (11:49 -0700)]
[flang] Save proc pointer inits in symbol table; add IsSaved() predicate to tools

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

5 years ago[flang] Checkpoint work
peter klausler [Tue, 6 Aug 2019 17:22:10 +0000 (10:22 -0700)]
[flang] Checkpoint work

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

5 years ago[flang] Deferred processing of pointer initializers (incomplete)
peter klausler [Mon, 5 Aug 2019 23:11:59 +0000 (16:11 -0700)]
[flang] Deferred processing of pointer initializers (incomplete)

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

5 years ago[flang] [OpenMP] parse tree changes for ATOMIC constructs (flang-compiler/f18#636)
Jinxin (Brian) Yang [Fri, 9 Aug 2019 16:39:55 +0000 (09:39 -0700)]
[flang] [OpenMP] parse tree changes for ATOMIC constructs (flang-compiler/f18#636)

1. make the parse tree nodes more conform with OpenMP spec

2. isolate the memory related clauses to make the parse tree nodes
   extendable for OpenMP 5.0

3. source provenance is saved for each atomic-clause (read, write, update,
   and capture); for atomic-clause that is not present, source location
   is saved for "ATOMIC" directive name itself

More tests will be added during Semantics.

Original-commit: flang-compiler/f18@8e2db2f868f9dce705aa0a504e1c9ac1af8fe08f
Reviewed-on: https://github.com/flang-compiler/f18/pull/636

5 years ago[flang] Merge pull request flang-compiler/f18#640 from flang-compiler/tsk-issue587
Tim Keith [Fri, 9 Aug 2019 13:48:16 +0000 (06:48 -0700)]
[flang] Merge pull request flang-compiler/f18#640 from flang-compiler/tsk-issue587

Fix bug with generic and specific having same name

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

5 years ago[flang] Fix bug with generic and specific having same name
Tim Keith [Thu, 8 Aug 2019 23:52:36 +0000 (16:52 -0700)]
[flang] Fix bug with generic and specific having same name

If a generic interface had a specific procedure with the same name that
is specified by an interface body, it was not handled correctly.

We were replacing the generic symbol with the symbol for the specific
procedure. Instead, leave the generic symbol in the scope and just
insert the new symbol for the specific into the generic.

Also, don't do distinguishability checks when one of the specific
procedures already has an error.

Fixes flang-compiler/f18#587.

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

5 years ago[flang] Merge pull request flang-compiler/f18#639 from flang-compiler/tsk-shared
Tim Keith [Fri, 9 Aug 2019 00:10:16 +0000 (17:10 -0700)]
[flang] Merge pull request flang-compiler/f18#639 from flang-compiler/tsk-shared

Fix problems building with shared libraries on Linux

Original-commit: flang-compiler/f18@0e3ed603c8d6ca611e5ae71cf52da72d351e81fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/639

5 years ago[flang] Fix problems building with shared libraries on Linux
Tim Keith [Thu, 8 Aug 2019 23:23:53 +0000 (16:23 -0700)]
[flang] Fix problems building with shared libraries on Linux

Building with gcc 8 or 9 with shared libraries had linking
problems in test/evaluate. Fix those by adding FortranSemantics
to the library dependencies.

Original-commit: flang-compiler/f18@009b9ab171b4a9d9a3b7ca79f1d0c0b5d0ee7a8c
Reviewed-on: https://github.com/flang-compiler/f18/pull/639

5 years ago[flang] Merge pull request flang-compiler/f18#631 from flang-compiler/jpr-fix-589
jeanPerier [Thu, 8 Aug 2019 12:48:20 +0000 (05:48 -0700)]
[flang] Merge pull request flang-compiler/f18#631 from flang-compiler/jpr-fix-589

Prevent result symbol to be converted into function when they are called

Original-commit: flang-compiler/f18@464310a1e3b8cc222b0069c213de01c4c4561eaf
Reviewed-on: https://github.com/flang-compiler/f18/pull/631

5 years ago[flang] Fix reabsing conflict issue
Jean Perier [Thu, 8 Aug 2019 12:30:21 +0000 (05:30 -0700)]
[flang] Fix reabsing conflict issue
Remove duplicate `IsFunctionResultWithSameNameAsFunction` declarartion.

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

5 years ago[flang] Answer PR 631 comments:
Jean Perier [Thu, 8 Aug 2019 10:46:14 +0000 (03:46 -0700)]
[flang] Answer PR 631 comments:
 - Create a function `IsFunctionResult(const Symbol &)` in
   lib/semantics/tools.h.
 - style edit in weird var definition style.

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

5 years ago[flang] Prevent result symbol to be converted into function when they are called.
Jean Perier [Wed, 7 Aug 2019 10:51:13 +0000 (03:51 -0700)]
[flang] Prevent result symbol to be converted into function when they are called.
+ Fix issue 589.
+ Catch empty subscript list in array reference
In name resolution, when skimming through the execution statement of a
function, calls to the result symbol should not trigger the conversion
of this symbol to a function symbol. The result is a data object and
cannot be called unless it was explictly declared to be a procedure
pointer.
Notably, recursive function calls cannot be made if RESULT was not used.

The symbol is prevented from being transformed into a function
symbol by transforming it into an object before skimming through the
executable statement. This is done after processing all the
specifications so that if the result actually is a procedure pointer,
the call to `ConvertToObjectEntity` introduced by this commit will
not convert it to an object by mistake.

This commit also introduce a check when fixing misparsed function
reference into array reference to verify the array reference has
array subscripts. Currently this went uncaught. It is not possible
to complain later in expressions because the subscript list of
expression might be empty for unrelated error recovery reasons
(e.g. if an entity of the wrong type appeared as susbcript).

Add related tests.

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

5 years ago[flang] Merge pull request flang-compiler/f18#607 from flang-compiler/jpr-fix-594
jeanPerier [Thu, 8 Aug 2019 08:55:50 +0000 (01:55 -0700)]
[flang] Merge pull request flang-compiler/f18#607 from flang-compiler/jpr-fix-594

Fix issue 594 and add a derived type component visitor framework

Original-commit: flang-compiler/f18@009db27bfaca2a84b0795c0d977c68cd8b57ce88
Reviewed-on: https://github.com/flang-compiler/f18/pull/607

5 years ago[flang] copyright update
Jean Perier [Wed, 31 Jul 2019 17:30:42 +0000 (10:30 -0700)]
[flang] copyright update

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

5 years ago[flang] use newly added DEREF in component iterator
Jean Perier [Wed, 31 Jul 2019 15:56:25 +0000 (08:56 -0700)]
[flang] use newly added DEREF in component iterator

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

5 years ago[flang] Checkpoint: derived type component iterators
Jean Perier [Wed, 31 Jul 2019 14:19:22 +0000 (07:19 -0700)]
[flang] Checkpoint: derived type component iterators

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

5 years ago[flang] Improve error messages about component types in allocate checks
Jean Perier [Fri, 26 Jul 2019 15:11:59 +0000 (08:11 -0700)]
[flang] Improve error messages about component types in allocate checks
Use component visitor framework to attach more information reagrding
where is the ultimate/potential component that is forbidden.
Also remove unused functions.

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

5 years ago[flang] Do not die on typeless source expression in allocate.
Jean Perier [Fri, 26 Jul 2019 13:39:26 +0000 (06:39 -0700)]
[flang] Do not die on typeless source expression in allocate.
While fixing 594, it appears the CHECK in allocate for non null
expression type pointer was too harsh as it could be a user error.
e.g: a boz used as source.

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

5 years ago[flang] Add a derived type component visitor framework
Jean Perier [Fri, 26 Jul 2019 13:33:48 +0000 (06:33 -0700)]
[flang] Add a derived type component visitor framework
After fixing 594, it appears there were issues in
FindUltimateComponent that was considering type bound
procedure as components.
This commit fixes and beef-up the component visitation by making a visitor
class for it. The main advantage of making it an class vs functions is that
it is possible to get the component chain to the result component for better
feedback for the user.
The framework allow a single place to define/handle what ultimate, direct and
potential components are.

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

5 years ago[flang] Fix issue 594
Jean Perier [Fri, 26 Jul 2019 13:31:44 +0000 (06:31 -0700)]
[flang] Fix issue 594
Add ProcBindingDetails to handling GetType.
Also add HostAssocDetails to be consitent with UseDetails handling
in this GetType.

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

5 years ago[flang] Merge pull request flang-compiler/f18#584 from CarolineConcatto/block_constru...
Steve Scalpone [Wed, 7 Aug 2019 18:52:11 +0000 (11:52 -0700)]
[flang] Merge pull request flang-compiler/f18#584 from CarolineConcatto/block_construct_patch

Adding semantic checks for Block Construct

Original-commit: flang-compiler/f18@47781549a3b042bd609f6cb5b1d8cdbd7983037d
Reviewed-on: https://github.com/flang-compiler/f18/pull/584

5 years ago[flang] Removing TODO comments as they are implemented by this patch
Caroline Concatto [Wed, 7 Aug 2019 07:47:04 +0000 (08:47 +0100)]
[flang] Removing TODO comments as they are implemented by this patch

Original-commit: flang-compiler/f18@885eb92b4f8ce07fc39af3655f6c04b74a10a9fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/584

5 years ago[flang] Removing two sentence error
Caroline Concatto [Tue, 6 Aug 2019 08:26:40 +0000 (09:26 +0100)]
[flang] Removing two sentence error

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

5 years ago[flang] Changes in SaveStmt message for Common Block name specifier
Caroline Concatto [Tue, 23 Jul 2019 09:29:53 +0000 (10:29 +0100)]
[flang] Changes in SaveStmt  message for Common Block name specifier

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