platform/upstream/llvm.git
4 years ago[flang] Merge pull request flang-compiler/f18#836 from flang-compiler/pmk-kinds
Peter Klausler [Fri, 22 Nov 2019 22:47:17 +0000 (14:47 -0800)]
[flang] Merge pull request flang-compiler/f18#836 from flang-compiler/pmk-kinds

Fold MERGE, use it in ISO_FORTRAN_ENV

Original-commit: flang-compiler/f18@34e04649fe6515a84cc5288b8ecfb133bd618e5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/836

4 years ago[flang] Fold MERGE, use it in ISO_FORTRAN_ENV
peter klausler [Thu, 21 Nov 2019 21:31:52 +0000 (13:31 -0800)]
[flang] Fold MERGE, use it in ISO_FORTRAN_ENV

Reduce use of intrinsic type KIND codes in ISO_FORTRAN_ENV

Use COUNT([x]) rather than MERGE(1,0,x)

Fix problems in array constructor expression analysis

Original-commit: flang-compiler/f18@79018f7126a55a4b8a907f121cc099d5f4f9666a
Reviewed-on: https://github.com/flang-compiler/f18/pull/836

4 years ago[flang] Need algorithm for std::min (flang-compiler/f18#837)
Isuru Fernando [Fri, 22 Nov 2019 21:54:36 +0000 (15:54 -0600)]
[flang] Need algorithm for std::min (flang-compiler/f18#837)

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

4 years ago[flang] Merge pull request flang-compiler/f18#835 from flang-compiler/pmk-call12
Peter Klausler [Thu, 21 Nov 2019 23:17:03 +0000 (15:17 -0800)]
[flang] Merge pull request flang-compiler/f18#835 from flang-compiler/pmk-call12

Enable, extend, and pass call12.f90 test; revert some recent changes

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

4 years ago[flang] Address review comments
peter klausler [Thu, 21 Nov 2019 21:55:17 +0000 (13:55 -0800)]
[flang] Address review comments

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

4 years ago[flang] Reformat all C++ in lib/*
peter klausler [Thu, 21 Nov 2019 21:35:20 +0000 (13:35 -0800)]
[flang] Reformat all C++ in lib/*

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

4 years ago[flang] Revert Symbol::operator=() changes
peter klausler [Wed, 20 Nov 2019 03:10:02 +0000 (19:10 -0800)]
[flang] Revert Symbol::operator=() changes

Rearrange "if" nest for clarity

Pass call12.f90 test.

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

4 years ago[flang] Merge pull request flang-compiler/f18#814 from flang-compiler/ps-c1140
psteinfeld [Thu, 21 Nov 2019 19:33:42 +0000 (11:33 -0800)]
[flang] Merge pull request flang-compiler/f18#814 from flang-compiler/ps-c1140

Changes to check for constraint C1140 --  deallocation of polymorphic entities

Original-commit: flang-compiler/f18@794b75155abfca6a938b5baa9bff0bc2cf2c4b67
Reviewed-on: https://github.com/flang-compiler/f18/pull/814

4 years ago[flang] Changes to check for constraint C1140
Pete Steinfeld [Tue, 5 Nov 2019 18:18:33 +0000 (10:18 -0800)]
[flang] Changes to check for constraint C1140
This constraint prohibits deallocation of polymorphic entities in a DO
CONCURRENT.

Section 9.7.3.2 specifies the situations that might cause deallocation
of a polymorphic entity. The ones that are applicable to a DO CONCURRENT
are exiting from a block that declares such variables, intrinsic
assignment, and an actual DEALLOCATE statement. This section also
specifies (paragraph 8) that deallocation of a derived type causes
deallocation of all of its allocatable subobjects.

Section 10.2.1.3 specifies what happens during intrinsic assignment.
Paragraph 3 states If the variable is an allocated allocatable variable,
it is deallocated if expr is an array of different shape, any
corresponding length type parameter values of the variable and expr
differ, or the variable is polymorphic and the dynamic type or any
corresponding kind type parameter values of the variable and expr
differ." Thus, an allocatable polymorphic variable on the left hand side
of an assignment statement gets deallocated. Paragraph 13 states that
  "For a noncoarray allocatable component the following sequence of
   operations is applied.
      (1) If the component of the variable is allocated, it is deallocated."

Thus, a variable on the left-hand side of an assignment statement might have noncorray allocatable components. Such components will be deallocated.
Deallocation can be caused by exiting from a block where the entity is
declared, from an assignment, and from direct deallocation.

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

4 years ago[flang] Merge pull request flang-compiler/f18#833 from flang-compiler/pmk-call11
Peter Klausler [Tue, 19 Nov 2019 22:53:26 +0000 (14:53 -0800)]
[flang] Merge pull request flang-compiler/f18#833 from flang-compiler/pmk-call11

For call11.f90: more checks on PURE subprograms and TBP bindings

Original-commit: flang-compiler/f18@1122b381d65add5d33ee5b39ac39b6d07e110955
Reviewed-on: https://github.com/flang-compiler/f18/pull/833

4 years ago[flang] For call11.f90: more checks on PURE subprograms and TBP bindings
peter klausler [Fri, 15 Nov 2019 22:26:10 +0000 (14:26 -0800)]
[flang] For call11.f90: more checks on PURE subprograms and TBP bindings

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

4 years ago[flang] Merge pull request flang-compiler/f18#802 from flang-compiler/pmk-io-header
Peter Klausler [Tue, 19 Nov 2019 18:32:13 +0000 (10:32 -0800)]
[flang] Merge pull request flang-compiler/f18#802 from flang-compiler/pmk-io-header

API for generated code to use to implement I/O data transfer statements

Original-commit: flang-compiler/f18@696bce96856a00b5912afb71bb21269698660eed
Reviewed-on: https://github.com/flang-compiler/f18/pull/802

4 years ago[flang] Define runtime I/O library interface to be used by generated code.
peter klausler [Fri, 11 Oct 2019 20:46:58 +0000 (13:46 -0700)]
[flang] Define runtime I/O library interface to be used by generated code.

Original-commit: flang-compiler/f18@82cb9b0c8794e253d6bec4fd01be1b6b5428fc56
Reviewed-on: https://github.com/flang-compiler/f18/pull/802

4 years ago[flang] Merge pull request flang-compiler/f18#832 from DavidTruby/drone_ci
Steve Scalpone [Mon, 18 Nov 2019 16:34:52 +0000 (09:34 -0700)]
[flang] Merge pull request flang-compiler/f18#832 from DavidTruby/drone_ci

Change images used for CI to solve build issues

Original-commit: flang-compiler/f18@369327a6d0c512973359f57a90b5482f45b2b6f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/832

4 years ago[flang] Another atempt to lower core count
David Truby [Mon, 18 Nov 2019 14:27:34 +0000 (14:27 +0000)]
[flang] Another atempt to lower core count

Original-commit: flang-compiler/f18@60eeb446b160826d587adeea939cc99416c03df5
Reviewed-on: https://github.com/flang-compiler/f18/pull/832

4 years ago[flang] Change images used for CI to solve build issues
David Truby [Mon, 18 Nov 2019 10:04:54 +0000 (10:04 +0000)]
[flang] Change images used for CI to solve build issues

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

4 years ago[flang] Merge pull request flang-compiler/f18#826 from flang-compiler/sjs-feature...
Steve Scalpone [Sat, 16 Nov 2019 22:03:47 +0000 (14:03 -0800)]
[flang] Merge pull request flang-compiler/f18#826 from flang-compiler/sjs-feature-rename

Rename features.h

Original-commit: flang-compiler/f18@6cf3196dbf3b857c5f308101709b473a5578743a
Reviewed-on: https://github.com/flang-compiler/f18/pull/826

4 years ago[flang] Rename flang-features to Fortran-features; update the guard macro.
Steve Scalpone [Fri, 15 Nov 2019 04:34:50 +0000 (20:34 -0800)]
[flang] Rename flang-features to Fortran-features; update the guard macro.

Original-commit: flang-compiler/f18@1a7f5596ecab5eb954130713c5b9e4f6a16c5ab7
Reviewed-on: https://github.com/flang-compiler/f18/pull/826

4 years ago[flang] Rename features.h because many linux systems have an include file called...
Steve Scalpone [Thu, 14 Nov 2019 23:16:38 +0000 (15:16 -0800)]
[flang] Rename features.h because many linux systems have an include file called features.h which can complicate makefiles that use a search path.

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

4 years ago[flang] Merge pull request flang-compiler/f18#825 from flang-compiler/pmk-call10
Peter Klausler [Fri, 15 Nov 2019 18:36:18 +0000 (10:36 -0800)]
[flang] Merge pull request flang-compiler/f18#825 from flang-compiler/pmk-call10

Extend, enable, and pass test call10.f90 (restrictions on PURE subprograms)

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

4 years ago[flang] Semantic checks for PURE subprograms (test call10.f90)
peter klausler [Tue, 12 Nov 2019 23:43:09 +0000 (15:43 -0800)]
[flang] Semantic checks for PURE subprograms (test call10.f90)

Fix bug found in testing

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

4 years ago[flang] Merge pull request flang-compiler/f18#829 from DavidTruby/drone_ci
Steve Scalpone [Fri, 15 Nov 2019 16:36:43 +0000 (08:36 -0800)]
[flang] Merge pull request flang-compiler/f18#829 from DavidTruby/drone_ci

Disable arm64 gcc builds in CI until they can be fixed

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

4 years ago[flang] Disable arm64 gcc builds in CI until they can be fixed
David Truby [Fri, 15 Nov 2019 16:30:28 +0000 (16:30 +0000)]
[flang] Disable arm64 gcc builds in CI until they can be fixed

Currently the arm64 gcc builds in CI are getting stuck,
so disable these to get CI working again until they're fixed.

Original-commit: flang-compiler/f18@49803e62ee3fdfc29ae0bdd6a712cc288e10bb26
Reviewed-on: https://github.com/flang-compiler/f18/pull/829

4 years ago[flang] Merge pull request flang-compiler/f18#827 from flang-compiler/tsk-bad-deref
Tim Keith [Fri, 15 Nov 2019 16:13:06 +0000 (08:13 -0800)]
[flang] Merge pull request flang-compiler/f18#827 from flang-compiler/tsk-bad-deref

Fix bad deferences in ProgramTree

Original-commit: flang-compiler/f18@4190785904a7953d964b3ee41bf9b9183a4d07b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/827

4 years ago[flang] Fix bad deference in ProgramTree
Tim Keith [Fri, 15 Nov 2019 03:22:24 +0000 (19:22 -0800)]
[flang] Fix bad deference in ProgramTree

We weren't handling MainProgram with no ProgramStmt correctly in
ProgramTree. When building it we were dereferencing an empty optional.
And in ResolveSpecificationParts we were dereferencing a null pointer.

Original-commit: flang-compiler/f18@1bda90d0051d7b67bf76f9aaa1f2963976a15d4a
Reviewed-on: https://github.com/flang-compiler/f18/pull/827

4 years ago[flang] Merge pull request flang-compiler/f18#823 from DavidTruby/drone_ci
Steve Scalpone [Fri, 15 Nov 2019 05:59:19 +0000 (21:59 -0800)]
[flang] Merge pull request flang-compiler/f18#823 from DavidTruby/drone_ci

Add CI file for cloud.drone.io

Original-commit: flang-compiler/f18@14a4f166e9004683a15cddb0020a9b5dd140a810
Reviewed-on: https://github.com/flang-compiler/f18/pull/823

4 years ago[flang] Reduce number of threads used for building.
David Truby [Thu, 14 Nov 2019 15:16:15 +0000 (15:16 +0000)]
[flang] Reduce number of threads used for building.

This is to avoid running out of memory on some builds.

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

4 years ago[flang] Add CI file for cloud.drone.io
David Truby [Wed, 13 Nov 2019 11:31:44 +0000 (11:31 +0000)]
[flang] Add CI file for cloud.drone.io

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

4 years ago[flang] Merge pull request flang-compiler/f18#817 from kiranktp/master
Steve Scalpone [Fri, 15 Nov 2019 01:46:43 +0000 (17:46 -0800)]
[flang] Merge pull request flang-compiler/f18#817 from kiranktp/master

Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule

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

4 years ago[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
kiranktp [Thu, 7 Nov 2019 09:47:57 +0000 (15:17 +0530)]
[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
Incorporated all review comments and updated the test case.

Change-Id: I03939bfc705cc5319a0b7da3305026b8403b8edc

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

4 years ago[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
kiranktp [Thu, 7 Nov 2019 09:47:57 +0000 (15:17 +0530)]
[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
Incorporated all review comments and updated the test case.

Change-Id: I03939bfc705cc5319a0b7da3305026b8403b8edc

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

4 years ago[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
kiranktp [Thu, 7 Nov 2019 09:47:57 +0000 (15:17 +0530)]
[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
Incorporated all review comments and updated the test case.

Change-Id: I03939bfc705cc5319a0b7da3305026b8403b8edc

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

4 years ago[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule
kiranktp [Thu, 7 Nov 2019 09:47:57 +0000 (15:17 +0530)]
[flang] Fix for flang-compiler/f18#694 - Unexpected error when compiling submodule

Change-Id: I03939bfc705cc5319a0b7da3305026b8403b8edc

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

4 years ago[flang] Merge pull request flang-compiler/f18#824 from flang-compiler/tsk-omp-crash
Tim Keith [Fri, 15 Nov 2019 00:16:30 +0000 (16:16 -0800)]
[flang] Merge pull request flang-compiler/f18#824 from flang-compiler/tsk-omp-crash

Fix crashes in ResolveOmpObject and RewriteOpenMPLoopConstruct

Original-commit: flang-compiler/f18@283542ff5a04fa5de65a252891567001fbe24857
Reviewed-on: https://github.com/flang-compiler/f18/pull/824

4 years ago[flang] Fix crashes in ResolveOmpObject and RewriteOpenMPLoopConstruct
Tim Keith [Thu, 14 Nov 2019 23:01:20 +0000 (15:01 -0800)]
[flang] Fix crashes in ResolveOmpObject and RewriteOpenMPLoopConstruct

Using debug build of f18, `omp-resolve01.f90` sometimes crashed in
`OmpVisitor::ResolveOmpObject`. This was because when the designator was
analyzed it could be rewritten from an `ArrayElement` to a `Substring`.
That made the reference to the `Name` inside the designator no longer
valid so the crash happened when it was referenced later. The fix is to
return when the substring is detected so the name is not referenced.

Also, the name returned from `ResolveDesignator` can but null so it must
be checked.

The crash in `RewriteOpenMPLoopConstruct` happened intermittently on
`omp-loop-association.f90`. It happened when the DO construct was the
last element of the block. In that case `block.erase()` returns an
iterator pointing to `block.end()` which must not be dereferenced.

Original-commit: flang-compiler/f18@3299972d047696aca28212131ab4644a3966fc8b
Reviewed-on: https://github.com/flang-compiler/f18/pull/824

4 years ago[flang] Merge pull request flang-compiler/f18#822 from flang-compiler/pmk-nullptr
Peter Klausler [Mon, 11 Nov 2019 22:41:22 +0000 (14:41 -0800)]
[flang] Merge pull request flang-compiler/f18#822 from flang-compiler/pmk-nullptr

Remove explicit comparisons to `nullptr` and most usage of `has_value()`

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

4 years ago[flang] Remove most comparisons to nullptr
peter klausler [Sat, 9 Nov 2019 17:29:31 +0000 (09:29 -0800)]
[flang] Remove most comparisons to nullptr

Remove needless usage of has_value()

Original-commit: flang-compiler/f18@1da7fcf7a54066b18e521620ecedb79c7cd2eb97
Reviewed-on: https://github.com/flang-compiler/f18/pull/822

4 years ago[flang] Merge pull request flang-compiler/f18#818 from flang-compiler/pmk-call09
Peter Klausler [Sat, 9 Nov 2019 17:00:27 +0000 (09:00 -0800)]
[flang] Merge pull request flang-compiler/f18#818 from flang-compiler/pmk-call09

Check semantics for actual arguments associated with dummy procedures

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

4 years ago[flang] checkpoint, all tests pass
peter klausler [Fri, 8 Nov 2019 00:01:38 +0000 (16:01 -0800)]
[flang] checkpoint, all tests pass

Fix name resolution for undeclared intrinsic actual arguments

Original-commit: flang-compiler/f18@12470f06bcc09eb4858af9c3e412752d7ba71aee
Reviewed-on: https://github.com/flang-compiler/f18/pull/818

4 years ago[flang] Merge pull request flang-compiler/f18#808 from Sameeranjoshi/master
Steve Scalpone [Fri, 8 Nov 2019 05:20:57 +0000 (21:20 -0800)]
[flang] Merge pull request flang-compiler/f18#808 from Sameeranjoshi/master

[OpenMP] Semantic check for Master construct

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

4 years ago[flang] Added passing test case
sameeranjoshi17 [Wed, 6 Nov 2019 11:43:22 +0000 (17:13 +0530)]
[flang] Added passing test case

Original-commit: flang-compiler/f18@752142055b0d029a0e483e6b8a74cc507f0f49ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/808

4 years ago[flang] Added test case for semantic check of OpenMP Master construct
sameeranjoshi17 [Wed, 6 Nov 2019 08:48:12 +0000 (14:18 +0530)]
[flang] Added test case for semantic check of OpenMP Master construct

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

4 years ago[flang] semantic checks for Master construct
sameeranjoshi17 [Sun, 3 Nov 2019 17:38:26 +0000 (23:08 +0530)]
[flang] semantic checks for Master construct

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

4 years ago[flang] Merge pull request flang-compiler/f18#815 from flang-compiler/tsk-defined-ops
Tim Keith [Thu, 7 Nov 2019 22:46:58 +0000 (14:46 -0800)]
[flang] Merge pull request flang-compiler/f18#815 from flang-compiler/tsk-defined-ops

Add support for logical abbreviations and .XOR.

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

4 years ago[flang] Add support for logical abbreviations and .XOR.
Tim Keith [Wed, 6 Nov 2019 23:54:26 +0000 (15:54 -0800)]
[flang] Add support for logical abbreviations and .XOR.

Update the grammar to handle logical abbreviations (e.g. `.A.` for `.AND.`)
when the feature is enabled. Only support `.X.` when both XOR and
logical abbreviations are enabled.

Fix the driver to enable logical abbreviations with the
`-flogical-abbreviations` option. This was already documented in
`documentation/Extensions.md`.

Remove `parser::Expr::XOR` from the parse tree and immediately map
`.XOR.` to `.NEQV.` if that feature is enabled. This was already being
done during expression analysis anyway.

Add `LanguageFeatureControl::GetNames` to return all of the names of
a logical or relational operator, depending on which features are
enabled. Use these in both name resolution and expression analysis.
Add `Not` to `LogicalOperator` to help in those cases.

Fix handling of BOZ literals: A numeric operation with one real or
integer operand and the other a BOZ literal is intrinsic.
Also, unary plus with a BOZ literal operand is also intrinsic.

Original-commit: flang-compiler/f18@956bd50bc7c93a31bb3ac39841d7b5ba15ff04a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/815

4 years ago[flang] Move features.h from parser to common
Tim Keith [Wed, 6 Nov 2019 19:15:03 +0000 (11:15 -0800)]
[flang] Move features.h from parser to common

Which features are enabled and disabled applies to more than just the
parser, so move that functionality to `common`.

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

4 years ago[flang] Merge pull request flang-compiler/f18#809 from flang-compiler/pmk-symbol...
Peter Klausler [Tue, 5 Nov 2019 18:56:41 +0000 (10:56 -0800)]
[flang] Merge pull request flang-compiler/f18#809 from flang-compiler/pmk-symbol-refs

Convert more non-nullable pointers to Reference<>s

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

4 years ago[flang] Change more pointers into references
peter klausler [Mon, 4 Nov 2019 19:08:13 +0000 (11:08 -0800)]
[flang] Change more pointers into references

Remove unused interface

Respond to review comments

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

4 years ago[flang] Relax the implementation of constraint C1302. (flang-compiler/f18#805)
vdonaldson [Tue, 5 Nov 2019 18:11:36 +0000 (10:11 -0800)]
[flang] Relax the implementation of constraint C1302. (flang-compiler/f18#805)

* Relax the implementation of constraint C1302.

When a list of format items can be unambiguously partitioned into individual items even though one or more otherwise required comma separators are omitted, generate a warning rather than an error.

Fixes flang-compiler/f18#703

Original-commit: flang-compiler/f18@79c0731137e1092c26c4dec7c12113c52a72effd
Reviewed-on: https://github.com/flang-compiler/f18/pull/805

4 years ago[flang] Merge pull request flang-compiler/f18#803 from flang-compiler/jpr-extremums
jeanPerier [Tue, 5 Nov 2019 11:49:25 +0000 (03:49 -0800)]
[flang] Merge pull request flang-compiler/f18#803 from flang-compiler/jpr-extremums

Implement MIN and MAX folding

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

4 years ago[flang] Implement MIN and MAX folding
Jean Perier [Thu, 31 Oct 2019 15:03:16 +0000 (08:03 -0700)]
[flang] Implement MIN and MAX folding

* Use Extremum<T> FoldOperation to fold MIN and MAX
* Fix Extremum<T> FolOperation
    * For character, the length is the one of the longest argument.
      Define and use `CharacterUtils<Kind>::Resize` helper to do this.
    * For array of all types, Extremum<T> with Ordering::Less was
      behaving like Ordering::Greater. This is because the default
      `ApplyElementwise` for `Operation` was selected and it then
       called the Extremum<T> constructor without the ordering
       argument (which was an optional defaulted to Greater).
      Define a specific handler for Extremum<T> and make the ordering
      argument mandatory to prevent this kind of bug to pass
      f18 compilation in the futur.
* Fix intrinsic.cc for MIN and MAX
    * When provided with two arguments, `Match` was adding an empty
      3rd optional actual argument. Later code working on min and
      max was not expecting this and failing. The fix prevent this
      empty argument to be created by changing the initial size of
      `actualForDummy` to actually be the number of dummies that do
      not have `Optionality::Repeats`

This commit fixes issue flang-compiler/f18#677.

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

4 years ago[flang] Merge pull request flang-compiler/f18#812 from flang-compiler/pmk-call08
Peter Klausler [Mon, 4 Nov 2019 22:36:10 +0000 (14:36 -0800)]
[flang] Merge pull request flang-compiler/f18#812 from flang-compiler/pmk-call08

Enable and pass call08.f90

Original-commit: flang-compiler/f18@997f59f4a352786a03ad5023b748af1a91b4e7c6
Reviewed-on: https://github.com/flang-compiler/f18/pull/812

4 years ago[flang] Enable and pass call08.f90
peter klausler [Mon, 4 Nov 2019 22:06:52 +0000 (14:06 -0800)]
[flang] Enable and pass call08.f90

Refine a check

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

4 years ago[flang] Merge pull request flang-compiler/f18#810 from flang-compiler/tsk-defined-ops
Tim Keith [Mon, 4 Nov 2019 20:58:48 +0000 (12:58 -0800)]
[flang] Merge pull request flang-compiler/f18#810 from flang-compiler/tsk-defined-ops

Fix build error using clang

Original-commit: flang-compiler/f18@0879810f8bf4f84bcce06a5b6feb7817609c1cdb
Reviewed-on: https://github.com/flang-compiler/f18/pull/810

4 years ago[flang] Fix build error using clang
Tim Keith [Mon, 4 Nov 2019 20:05:51 +0000 (12:05 -0800)]
[flang] Fix build error using clang

Change `AllFortranNames()` to return a `std::vector` rather than a
`std::initialization_list`. The latter doesn't own its underlying
storage and so can't be returned as a value. clang detects this and
issues a warning.

Two tests in `resolve63.f90` behave differently with clang and require
further investigation.

Original-commit: flang-compiler/f18@1ed3a3cfee1d372b23afc4529d5867ecd46db681
Reviewed-on: https://github.com/flang-compiler/f18/pull/810

4 years ago[flang] Merge pull request flang-compiler/f18#807 from flang-compiler/tsk-defined-ops
Tim Keith [Mon, 4 Nov 2019 18:56:12 +0000 (10:56 -0800)]
[flang] Merge pull request flang-compiler/f18#807 from flang-compiler/tsk-defined-ops

Resolve extended intrinsic operators

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

4 years ago[flang] Resolve extended intrinsic operators
Tim Keith [Sat, 2 Nov 2019 16:56:46 +0000 (09:56 -0700)]
[flang] Resolve extended intrinsic operators

Enhance `ArgumentAnalyzer` to do most of the work for this.
For each kind of operator that might have a user-defined form we follow
this process:
- analyze the arguments
- if the types and shapes match the intrinsic operator do the usual
  processing
- otherwise attempt to interpret it as a user-defined operator with
  `TryDefinedOp`

When we fail to resolve an operator, produce different errors depending
on whether there is a user-defined operator available or not.
If there is, report that neither user-defined nor intrinsic operator
worked. If there is not, describe the rules for the intrinsic operator.
In either case, include the type(s) of the operand(s).

Most of the uses of `ArgumentAnalyzer` are in helper functions that
apply to classes of operators.
For consistency, rename `BinaryOperationHelper` to `NumericBinaryOperator`
and `LogicalHelper` to `LogicalBinaryHelper` and introduce `NumericUnaryHelper`
for unary `+` and `-`.  `.NOT.` and `//` are not implemented in helpers.

Replace `success_` with `fatalErrors_` in `ArgumentAnalyzer` for
consistency with `ExpressionAnalyzer`.

Add `NumericOperator` and `LogicalOperator` enums to `Fortran.h` to go
with `RelationalOperator`. Add `AddFortran` functions to each to convert
to a Fortran source string. `RelationalOperator` also has `AllFortranNames`
because there are multiple names for each operator. This replaces
`LogicalOperator` in `expression.h` and the string representation of
the operators in `formatting.cc`.

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

4 years ago[flang] Merge pull request flang-compiler/f18#806 from flang-compiler/pmk-calls
Peter Klausler [Sat, 2 Nov 2019 17:56:47 +0000 (10:56 -0700)]
[flang] Merge pull request flang-compiler/f18#806 from flang-compiler/pmk-calls

Enable and pass test call07.f90

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

4 years ago[flang] Enable and pass test call07.f90
peter klausler [Fri, 1 Nov 2019 20:08:16 +0000 (13:08 -0700)]
[flang] Enable and pass test call07.f90

Remove a std::move()

Final tweaks after testing and review

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

4 years ago[flang] Merge pull request flang-compiler/f18#804 from flang-compiler/pmk-c_str
Peter Klausler [Thu, 31 Oct 2019 21:01:14 +0000 (14:01 -0700)]
[flang] Merge pull request flang-compiler/f18#804 from flang-compiler/pmk-c_str

Use c_str() rather than data() where NUL termination is assumed

Original-commit: flang-compiler/f18@97a0a0f78f6b51dfecb5ce3302496a4982394ab7
Reviewed-on: https://github.com/flang-compiler/f18/pull/804

4 years ago[flang] Use c_str() rather than data() where NUL termination is assumed
peter klausler [Thu, 31 Oct 2019 20:25:28 +0000 (13:25 -0700)]
[flang] Use c_str() rather than data() where NUL termination is assumed

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

4 years ago[flang] Merge pull request flang-compiler/f18#801 from flang-compiler/pmk-call06
Peter Klausler [Wed, 30 Oct 2019 22:51:17 +0000 (15:51 -0700)]
[flang] Merge pull request flang-compiler/f18#801 from flang-compiler/pmk-call06

More semantic checks for calls & declarations

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

4 years ago[flang] enable call06.f90 test
peter klausler [Tue, 29 Oct 2019 19:46:25 +0000 (12:46 -0700)]
[flang] enable call06.f90 test

Relax checking when irrelevant due to INTENT(IN)

Add and pass call14.f90 test on VALUE

Allow ASYNCHRONOUS/VOLATILE to apply to host/USE associated entities, add tests

Pass call06

Check C827 & C828, fix tests

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

4 years ago[flang] Merge pull request flang-compiler/f18#788 from flang-compiler/pmk-ref-wrap
Peter Klausler [Tue, 29 Oct 2019 19:45:13 +0000 (12:45 -0700)]
[flang] Merge pull request flang-compiler/f18#788 from flang-compiler/pmk-ref-wrap

Create `common::Reference<>`, use it to replace non-nullable pointers

Original-commit: flang-compiler/f18@0857755e59b822115370f26f5951046068e7ee7d
Reviewed-on: https://github.com/flang-compiler/f18/pull/788

4 years ago[flang] Use reference_wrapper in vectors and sets
peter klausler [Tue, 22 Oct 2019 23:53:29 +0000 (16:53 -0700)]
[flang] Use reference_wrapper in vectors and sets

Convert some CharBlock references to values

Replace more pointers with reference wrappers

Restore object references that were converted to value semantics in an earlier commit

Use Reference<> in Scope

Fix new component iterator

Document pitfall that bit me

final tweaks before rebasing and merging

Rebasing

Original-commit: flang-compiler/f18@87874af934a0344f40374d9288e6805a2757e32f
Reviewed-on: https://github.com/flang-compiler/f18/pull/788

4 years ago[flang] Throw error in case of missing listed test
Jinxin Yang [Mon, 28 Oct 2019 17:34:47 +0000 (10:34 -0700)]
[flang] Throw error in case of missing listed test

Original-commit: flang-compiler/f18@dabc0ba0e0441d1057218d84a6b6f755985e50cc

4 years ago[flang] [OpenMP] Test Infra update to support OpenMP symbol tests
Jinxin Yang [Fri, 25 Oct 2019 22:56:53 +0000 (15:56 -0700)]
[flang] [OpenMP] Test Infra update to support OpenMP symbol tests

During the symbol tests, OpenMP directives (start with "!$omp")
line needs to be saved for 1.f90 and 2.f90. Also moved "OPTIONS:"
detection to common.sh as "$USER_OPTIONS"

Original-commit: flang-compiler/f18@7d4e8e8ad52608ed9e4b5239371533cd28f0fbda

4 years ago[flang] [OpenMP] address more comments
Jinxin Yang [Thu, 24 Oct 2019 14:04:44 +0000 (07:04 -0700)]
[flang] [OpenMP] address more comments

The major changes are:
  1) changed the non-nullptr type to reference
  2) changed ResolveOmpObject to use std::visit
  3) the rest of the changes are about positions and naming

Original-commit: flang-compiler/f18@93debe59f39542aa6c891a0b7b320ac48ddad44a

4 years ago[flang] [OpenMP] adjust for PR#753 `OmpObject` parse tree change
Jinxin Yang [Mon, 21 Oct 2019 22:51:46 +0000 (15:51 -0700)]
[flang] [OpenMP] adjust for PR#753 `OmpObject` parse tree change

PR#753 changed the `OmpObject` to be:

```
struct OmpObject {
  UNION_CLASS_BOILERPLATE(OmpObject);
  std::variant<Designator, /*common block*/ Name> u;
};
```

This commit adjust the logic flow for `ResolveOmpObject` based on
the above parse tree change.

For an `OmpObject`,
```
if (Designator) {
  if (DataRef.Name) {
    // Resolve Names
  } else {
    // ResolveDesignator
    // AnalyzeExpr
    if (Designator.Substring) {
      // Error
    }
    // other checks like StructureComponent, ArrayElement, etc.
  }
} else if (Name) {
  // Resolve COMMON block
}
```

Original-commit: flang-compiler/f18@e5c1b92c15e5e8aee202d3469e337893510cfe21

4 years ago[flang] [OpenMP] Implement no-multiple-appearance rule for DSA Clauses
Jinxin Yang [Wed, 18 Sep 2019 00:52:46 +0000 (17:52 -0700)]
[flang] [OpenMP] Implement no-multiple-appearance rule for DSA Clauses

DSA stands for Data-Sharing Attribute. This work is part of the
Name Resolution for OpenMP framework (data-refs on clauses part)

Based on 2.15.3: A list item that specifies a given variable may
not appear in more than one clause on the same directive, except that
a variable may be specified in both firstprivate and lastprivate clauses.

Through a temporary `std::set` of `const Symbol *` to keep track of
all the symbols on a certain OpenMP directive, we can determine whether
a variable `Name` (or `Symbol`, more accurately) has already appeared on
another DSA clause already, with the exception of FIRSTPRIVATE clause
and LASTPRIVATE clause. This rule applies to `/COMMON block/` also and
the source provenance shows on error message points to the `Name` between
slashes.

Added two more tests and changed some existing tests to accommodate
this commit. I intend to keep the `omp-clause-validity01.f90` test to
do the validity checks only.

Original-commit: flang-compiler/f18@0d7828c21e8dfe02e470a861178b7747100516ae

4 years ago[flang] [OpenMP] avoid creating new symbol for common block
Jinxin Yang [Tue, 17 Sep 2019 04:26:40 +0000 (21:26 -0700)]
[flang] [OpenMP] avoid creating new symbol for common block

Original-commit: flang-compiler/f18@ba2cceb4a2eb3846053d8f480bd6406d562f9f1c

4 years ago[flang] [OpenMP] add common block example
Jinxin Yang [Mon, 16 Sep 2019 06:08:29 +0000 (23:08 -0700)]
[flang] [OpenMP] add common block example

Original-commit: flang-compiler/f18@a4c923e848bd55adc734808dbc019951610c29e6

4 years ago[flang] [OpenMP] OmpVisitor framework for Name Resolution
Jinxin Yang [Wed, 11 Sep 2019 21:42:51 +0000 (14:42 -0700)]
[flang] [OpenMP] OmpVisitor framework for Name Resolution

This is a preliminary framework to do the name resolution for
data references on the OpenMP clauses. Unlike data references
in the OpenMP region, clauses determining the data-sharing or
data-mapping attributes are straightforward and the resolution
process could be extended to do the name resolution in the OpenMP
region. It is hard to determine what kind of checks can be done
in this visitor and what checks should be done later after name
resolution. But the guide line is that `After the completion of
this phase, every Name corresponds to a Symbol with proper OpenMP
attribute(s) determined unless an error occurred.`

1. Take data-sharing clauses as example, create new symbol for
variable that require private access within the OpenMP region.
Declare the entity implicitly if necessary. The new symbol has
`HostAssocDetails`, which is mentioned in the `OpenMP-semantics.md`.

2. For `Shared` or `ThreadPrivate`, no symbol needs to be created.
OpenMP attribute Flag `OmpThreadprivate` needs to be marked for
`Threadprivate` because the `threadprivate` attribute remains the
same whenever these variables are referenced in the program.
`Names` in `Shared` clause need to be resolved to associate the
symbols in the clause enclosing scope (contains the OpenMP directive)
but `OmpShared` does not need to be marked. Declare the entity
implicitly if necessary.

3. For `COMMON block`, when a named common block appears in a list,
it has the same meaning as if every explicit member of the common
block appeared in the list. Also, a common block name specified in
a data-sharing attribute clause must be declared to be a common
block in the same scoping unit in which the data-sharing attribute
clause appears. So, if a named common block appears on a `PRIVATE`
clause, all its members should have new symbols created within the
OpenMP region (scope). For later Semantic checks and CG, a new
symbol is also created for common block name with `HostAssocDetails`.

There are many things are still on the TODO list:
- Better error/warning messages with directive/clause source provenance

- Resolve variables referenced in the OpenMP region, for example,
  `private(tt%a)` is not allowed but `tt%a = 1` is allowed in the
  OpenMP region and a private version of `tt` maybe created for
  the region. The functions created in the `OmpVisitor` should be
  able to handle the name resolution on the statement too (more
  data structures may be introduced). This is a big portion and may
  require some interface changes to distinguish a reference is on
  `OpenMP directive/clause` or `statements within OpenMP region`.

- Same data reference appears on multiple data-sharing clauses.

- Take association into consideration for example Pointer association,
  `ASSOCIATE` construct, and etc.

- Handle `Array Sections` and `Array or Structure Element`.

- Handle all the name resolution for directives/clauses that have
  `parser::Name`.

- More tests

Original-commit: flang-compiler/f18@b2ea520885eceb6e118f690b95e1846183fe378b

4 years ago[flang] Merge pull request flang-compiler/f18#789 from flang-compiler/ps-issue781
psteinfeld [Fri, 25 Oct 2019 17:26:58 +0000 (10:26 -0700)]
[flang] Merge pull request flang-compiler/f18#789 from flang-compiler/ps-issue781

Changes to check for calls to PURE procedure components

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

4 years ago[flang] Changes to check for calls to PURE procedure components
Pete Steinfeld [Wed, 23 Oct 2019 22:56:22 +0000 (15:56 -0700)]
[flang] Changes to check for calls to PURE procedure components

This addresses issue flang-compiler/f18#781.  I changed my test to create a PURE procedure
component by using an interface as suggested by Peter and Jean.  I then
enhanced the function IsPureProcedure() in tools.cc to cover this case
and updated the code in check-do.cc to perform the test.

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

4 years ago[flang] Merge pull request flang-compiler/f18#792 from flang-compiler/pmk-call05...
Peter Klausler [Fri, 25 Oct 2019 16:01:51 +0000 (09:01 -0700)]
[flang] Merge pull request flang-compiler/f18#792 from flang-compiler/pmk-call05-again

pmk-call05 again

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

4 years ago[flang] Restore a review comment response
peter klausler [Fri, 25 Oct 2019 16:01:27 +0000 (09:01 -0700)]
[flang] Restore a review comment response

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

4 years ago[flang] Fix duplicate messages
peter klausler [Thu, 24 Oct 2019 23:38:09 +0000 (16:38 -0700)]
[flang] Fix duplicate messages

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

4 years ago[flang] Restored changes from pmk-call05
peter klausler [Thu, 24 Oct 2019 23:08:06 +0000 (16:08 -0700)]
[flang] Restored changes from pmk-call05

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

4 years ago[flang] Merge pull request flang-compiler/f18#790 from flang-compiler/pmk-expr-msgs
Peter Klausler [Thu, 24 Oct 2019 22:03:26 +0000 (15:03 -0700)]
[flang] Merge pull request flang-compiler/f18#790 from flang-compiler/pmk-expr-msgs

Add contextualizing interfaces to ExpressionAnalyzer and ContextualMe…

Original-commit: flang-compiler/f18@85136c45efaea28e502e66a498604ac64fb7924f
Reviewed-on: https://github.com/flang-compiler/f18/pull/790

4 years ago[flang] Add contextualizing interfaces to ExpressionAnalyzer and ContextualMessages
peter klausler [Thu, 24 Oct 2019 21:55:25 +0000 (14:55 -0700)]
[flang] Add contextualizing interfaces to ExpressionAnalyzer and ContextualMessages

Original-commit: flang-compiler/f18@30a004d7b162a425fa41acd9f51fc3dc5e8624c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/790

4 years ago[flang] Merge pull request flang-compiler/f18#780 from flang-compiler/ps-move_alloc
psteinfeld [Wed, 23 Oct 2019 21:17:30 +0000 (14:17 -0700)]
[flang] Merge pull request flang-compiler/f18#780 from flang-compiler/ps-move_alloc

Changes to disallow image control statements in DO CONCURRENT

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

4 years ago[flang] # This is a combination of 2 commits.
Pete Steinfeld [Fri, 11 Oct 2019 21:39:33 +0000 (14:39 -0700)]
[flang] # This is a combination of 2 commits.
# This is the 1st commit message:

Changes to disallow image control statements in DO CONCURRENT

Most of these changes were already implemented.  The last remaining part was to check for calls to move_alloc with coarray arguments.  This set of changes implements that.  I also bundled other changes.  Specifically:

All of the code to detect image control statements was moved from check-do.cc to tools.cc so that it could be used by other semantic checking functions.

I added location information to the error messages for all DO semantics checks to highlight either the DO loop associated with the error or other relevant source locations.

I cleaned up the error messages associated with DO semantics so that they have more consistent grammar and punctuation.

I eliminated redundant checks for IEEE_GET_FLAG and IEEE_HALTING_MODE.

I removed the redundant test doconcurrent08.f90.

Responses to pull request comments

I changed the interface to determine whether a statement is an image control
statement to use an ExecutableConstruct as its input.  Since
ExecutableConstruct contains types that do not have source location information
(ChangeTeamConstruct and CriticalConstruct), I also created a function to get
the source location of an ExecutableConstruct.  Also, some ExecutableConstructs
are image control statements because they reference coarrays.  I wanted to tell
users that the reason that an ALLOCATE statement (for example) is an image
control statement because it references a coarray.  To make this happen, I
added another function to return a message for image control statements that
reference coarrays.

I also cleaned up the references to the standard in comments in check-do.cc to
briefly describe the contents of those constraints.

I also added messages that refer to the enclosing DO CONCURRENT statement for
error messages where appropriate.

Responses to pull request comments

The biggest change was to redo the implementation of "IsImageControlStmt()" to
use a custom visitor that strips off the "common::Indirection<...>" prefix of
most of the image control statement types and also takes advantage of
"common::HasMember<...>" to determine if a variant contains a specific type.

Spelling error.

# This is the commit message flang-compiler/f18#2:

More refactoring in response to comments on the pull request.

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

4 years ago[flang] Merge pull request flang-compiler/f18#786 from flang-compiler/tsk-defined-ops
Tim Keith [Wed, 23 Oct 2019 13:31:27 +0000 (06:31 -0700)]
[flang] Merge pull request flang-compiler/f18#786 from flang-compiler/tsk-defined-ops

Resolve defined operators to specifics

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

4 years ago[flang] Resolve defined operators to specifics
Tim Keith [Tue, 22 Oct 2019 16:31:33 +0000 (09:31 -0700)]
[flang] Resolve defined operators to specifics

Most of these changes involve moving code around so that it case be
used for `DefinedUnary` and `DefinedBinary`. The functional changes are
in the `Analyze` member functions for those cases where the arguments
are now analyzed, the generic is resolved, and a `FunctionRef` is
created.

Add `ArgumentAnalyzer` to handling building of the `ActualArguments`
of a call. This allows the code to be shared with the defined unary
and defined binary cases. Move `AnalyzeActualArgument` and
`AnalyzeActualArgument` into that class (renaming both to `Analyze`).

Create an overload of `GetCalleeAndArguments` for the `Name` case so it
can be used for defined ops where we don't have a `ProcedureDesignator`.

Move `IsGenericDefinedOp` to `tools.h` to make it available to the
new code.

We were using `semantics::CheckExplicitInterface` to resolve a generic
interface to a specific procedure based on actual arguments. The problem
with that is that it performs too many checks. We just want to get the
right specific; there may be errors reported later during call analysis.

To fix this, add a new function, `CheckInterfaceForGeneric`, to perform
this check. It shares code with `CheckExplicitInterface`, but it passes
in a null scope to indicate that the full set of checks aren't
necessary in `CheckExplicitInterfaceArg`. Instead we lift the call to
`TypeAndShape::IsCompatibleWith` out of `CheckExplicitDataArg`, and skip
the latter when there is no scope.

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

4 years ago[flang] Merge pull request flang-compiler/f18#787 from flang-compiler/pmk-fix
Peter Klausler [Tue, 22 Oct 2019 22:57:00 +0000 (15:57 -0700)]
[flang] Merge pull request flang-compiler/f18#787 from flang-compiler/pmk-fix

Fix bad new test, and fix detection of test failures in that test too

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

4 years ago[flang] Fix bad new test, and fix detection of test failures in that test too
peter klausler [Tue, 22 Oct 2019 22:28:26 +0000 (15:28 -0700)]
[flang] Fix bad new test, and fix detection of test failures in that test too

Original-commit: flang-compiler/f18@38ec2a879b63e633a7663698861cfc9aba56acd6
Reviewed-on: https://github.com/flang-compiler/f18/pull/787

4 years ago[flang] Merge pull request flang-compiler/f18#785 from flang-compiler/pmk-int128
Peter Klausler [Tue, 22 Oct 2019 20:18:59 +0000 (13:18 -0700)]
[flang] Merge pull request flang-compiler/f18#785 from flang-compiler/pmk-int128

Implement uint128_t for impoverished build environments

Original-commit: flang-compiler/f18@6ea37f7cf56056e8d2bd815f87ae669f29787aed
Reviewed-on: https://github.com/flang-compiler/f18/pull/785

4 years ago[flang] Work around a gcc-7.2 specific build bug by recoding with a better approach
peter klausler [Tue, 22 Oct 2019 17:34:05 +0000 (10:34 -0700)]
[flang] Work around a gcc-7.2 specific build bug by recoding with a better approach

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

4 years ago[flang] Fix clang performance problem with new code
peter klausler [Mon, 21 Oct 2019 21:57:48 +0000 (14:57 -0700)]
[flang] Fix clang performance problem with new code

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

4 years ago[flang] Testing and debugging
peter klausler [Mon, 21 Oct 2019 21:14:38 +0000 (14:14 -0700)]
[flang] Testing and debugging

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

4 years ago[flang] Add software uint128_t (debugging incomplete)
peter klausler [Fri, 18 Oct 2019 23:51:29 +0000 (16:51 -0700)]
[flang] Add software uint128_t (debugging incomplete)

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

4 years ago[flang] Merge pull request flang-compiler/f18#783 from flang-compiler/pmk-call04
Peter Klausler [Mon, 21 Oct 2019 20:21:48 +0000 (13:21 -0700)]
[flang] Merge pull request flang-compiler/f18#783 from flang-compiler/pmk-call04

Add call semantics checks, pass call04.f90 test

Original-commit: flang-compiler/f18@2555860e779d5ee3e475e72fa66027ddbb1cd394
Reviewed-on: https://github.com/flang-compiler/f18/pull/783

4 years ago[flang] Pass call04
peter klausler [Thu, 17 Oct 2019 23:15:20 +0000 (16:15 -0700)]
[flang] Pass call04

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

4 years ago[flang] most call04 checks
peter klausler [Thu, 17 Oct 2019 19:28:25 +0000 (12:28 -0700)]
[flang] most call04 checks

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

4 years ago[flang] Merge pull request flang-compiler/f18#782 from flang-compiler/pmk-calls
Peter Klausler [Mon, 21 Oct 2019 19:43:13 +0000 (12:43 -0700)]
[flang] Merge pull request flang-compiler/f18#782 from flang-compiler/pmk-calls

Further semantics checks for procedure references

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

4 years ago[flang] Use component iterators in check-call.cc
peter klausler [Thu, 17 Oct 2019 22:29:26 +0000 (15:29 -0700)]
[flang] Use component iterators in check-call.cc

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

4 years ago[flang] Address remaining initial comments
peter klausler [Thu, 17 Oct 2019 19:10:33 +0000 (12:10 -0700)]
[flang] Address remaining initial comments

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

4 years ago[flang] Address most review comments
peter klausler [Thu, 17 Oct 2019 17:57:01 +0000 (10:57 -0700)]
[flang] Address most review comments

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

4 years ago[flang] Pad short CHARACTER actual arguments
peter klausler [Wed, 16 Oct 2019 22:36:54 +0000 (15:36 -0700)]
[flang] Pad short CHARACTER actual arguments

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