Commit Graph

2586 Commits

Author SHA1 Message Date
peter klausler b5eec67fc4 [flang] Add contextualizing interfaces to ExpressionAnalyzer and ContextualMessages
Original-commit: flang-compiler/f18@30a004d7b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/790
2019-10-24 14:55:25 -07:00
psteinfeld f39e704606 [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@adc753c306
Reviewed-on: https://github.com/flang-compiler/f18/pull/780
2019-10-23 14:17:30 -07:00
Pete Steinfeld 196fec7d85 [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@3f0a0155b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/780
2019-10-23 14:06:16 -07:00
Tim Keith f0cef274b9 [flang] Merge pull request flang-compiler/f18#786 from flang-compiler/tsk-defined-ops
Resolve defined operators to specifics

Original-commit: flang-compiler/f18@b10a60d2d6
Reviewed-on: https://github.com/flang-compiler/f18/pull/786
2019-10-23 06:31:27 -07:00
Tim Keith 373f7489ef [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@fff2d1580f
Reviewed-on: https://github.com/flang-compiler/f18/pull/786
2019-10-23 06:25:51 -07:00
Peter Klausler 2a7af74b3e [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@7c32e67571
Reviewed-on: https://github.com/flang-compiler/f18/pull/787
2019-10-22 15:57:00 -07:00
peter klausler 7aea2f6cb9 [flang] Fix bad new test, and fix detection of test failures in that test too
Original-commit: flang-compiler/f18@38ec2a879b
Reviewed-on: https://github.com/flang-compiler/f18/pull/787
2019-10-22 15:28:26 -07:00
Peter Klausler 26334a9e1b [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@6ea37f7cf5
Reviewed-on: https://github.com/flang-compiler/f18/pull/785
2019-10-22 13:18:59 -07:00
peter klausler f3ae44f645 [flang] Work around a gcc-7.2 specific build bug by recoding with a better approach
Original-commit: flang-compiler/f18@bc2b4015b0
Reviewed-on: https://github.com/flang-compiler/f18/pull/785
2019-10-22 10:34:05 -07:00
peter klausler 4f761d601e [flang] Fix clang performance problem with new code
Original-commit: flang-compiler/f18@b70cac3ba8
Reviewed-on: https://github.com/flang-compiler/f18/pull/785
Tree-same-pre-rewrite: false
2019-10-21 14:58:26 -07:00
peter klausler dc4fac5634 [flang] Testing and debugging
Original-commit: flang-compiler/f18@3fa2e55bef
Reviewed-on: https://github.com/flang-compiler/f18/pull/785
Tree-same-pre-rewrite: false
2019-10-21 14:58:25 -07:00
peter klausler 2348d593ae [flang] Add software uint128_t (debugging incomplete)
Original-commit: flang-compiler/f18@5be270e604
Reviewed-on: https://github.com/flang-compiler/f18/pull/785
Tree-same-pre-rewrite: false
2019-10-21 14:58:25 -07:00
Peter Klausler 416d9ced52 [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@2555860e77
Reviewed-on: https://github.com/flang-compiler/f18/pull/783
2019-10-21 13:21:48 -07:00
peter klausler 9cf827d297 [flang] Pass call04
Original-commit: flang-compiler/f18@5a44837804
Reviewed-on: https://github.com/flang-compiler/f18/pull/783
2019-10-21 12:44:17 -07:00
peter klausler e6bf9526e1 [flang] most call04 checks
Original-commit: flang-compiler/f18@65289a66d1
Reviewed-on: https://github.com/flang-compiler/f18/pull/783
Tree-same-pre-rewrite: false
2019-10-21 12:44:17 -07:00
Peter Klausler a1839554bf [flang] Merge pull request flang-compiler/f18#782 from flang-compiler/pmk-calls
Further semantics checks for procedure references

Original-commit: flang-compiler/f18@fbdd919a14
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
2019-10-21 12:43:13 -07:00
peter klausler 15f38e2d67 [flang] Use component iterators in check-call.cc
Original-commit: flang-compiler/f18@e78db8907f
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
2019-10-17 15:29:26 -07:00
peter klausler 5f8817bdac [flang] Address remaining initial comments
Original-commit: flang-compiler/f18@acd307c91f
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-17 12:10:33 -07:00
peter klausler db4ae5cd98 [flang] Address most review comments
Original-commit: flang-compiler/f18@43720b5057
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-17 10:57:01 -07:00
peter klausler ca9d6be0e4 [flang] Pad short CHARACTER actual arguments
Original-commit: flang-compiler/f18@b9c890ca9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-16 15:36:54 -07:00
peter klausler 4abdc30b63 [flang] Revert to returning default INTEGER for LEN() and offset-in-CHARACTER intrinsics; further shape analysis of intrinsic results
Original-commit: flang-compiler/f18@561f5965b2
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-16 11:53:03 -07:00
peter klausler f090eb878e [flang] Better shape analysis for CSHIFT, EOSHIFT, SPREAD
Original-commit: flang-compiler/f18@eb43df85a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-16 10:35:34 -07:00
peter klausler 3a4091b5e3 [flang] Fix some bugs exposed by testing new checks
Original-commit: flang-compiler/f18@9cc70dcad6
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-16 09:39:37 -07:00
peter klausler 4c37c06597 [flang] rebase
Original-commit: flang-compiler/f18@2691da3836
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-11 15:41:11 -07:00
peter klausler b8d4f79d59 [flang] pass call03
Original-commit: flang-compiler/f18@8c076bd89b
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-10 16:36:47 -07:00
peter klausler d022fc1cca [flang] definability tests
Original-commit: flang-compiler/f18@4b71f003a9
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-10 16:33:25 -07:00
peter klausler f29394589e [flang] Move call semantic checking into lib/semantics
Original-commit: flang-compiler/f18@7996c85cf3
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-10 16:23:07 -07:00
peter klausler b71355ca1e [flang] checkpoint
checkpoint

checkpoint

Original-commit: flang-compiler/f18@99d12a7215
Reviewed-on: https://github.com/flang-compiler/f18/pull/782
Tree-same-pre-rewrite: false
2019-10-10 16:09:57 -07:00
Tim Keith ea7240c3de [flang] Merge pull request flang-compiler/f18#778 from flang-compiler/tsk-generics
Generic name resolution in expression analysis

Original-commit: flang-compiler/f18@1688bef152
Reviewed-on: https://github.com/flang-compiler/f18/pull/778
2019-10-10 11:47:12 -07:00
Tim Keith 6acae749c8 [flang] Generic name resolution in expression analysis
Implement the basics of resolving generic names in expressions.

`ExpressionAnalyzer::ResolveGeneric` maps the symbol for a generic
name to the specific procedure appropriate for the actual arguments.
Extract `CheckExplicitInterface` out of `CheckArguments` so that it
can be tried for each specific procedure of the generic as part of
the test to see which is compatible.

Note that it may be there is an elemental and non-elemental specific
procedure that is compatible with the actual arguments. In that case
the generic is resolved to the non-elemental one.

Test this by using generic functions in specification expressions
that must be written to module files. Verify how the generics were
resolved by looking at the generated `.mod` files.

There is more work to be done in this area: the passed-object dummy
argument is not considered and in some cases generated module files
are not correct.

Original-commit: flang-compiler/f18@50e458045a
Reviewed-on: https://github.com/flang-compiler/f18/pull/778
2019-10-10 11:46:26 -07:00
Peter Klausler 9c8312208d [flang] Merge pull request flang-compiler/f18#776 from flang-compiler/pmk-call
More procedure reference semantics checking (mostly arguments)

Original-commit: flang-compiler/f18@c582562397
Reviewed-on: https://github.com/flang-compiler/f18/pull/776
2019-10-07 11:28:40 -07:00
peter klausler b32a435b0b [flang] Update preprocessing document, commentary
Extend documentation on preprocessing

IsSimplyContiguous

basic skeleton

Apply suggested improvements to mod-file.cc

Checks for new call13.f90 (15.4.2.2 explicit interfaces)

Implement checking for procedures that can be called via an implicit interface

Argument checking, test fixing

Better argument checking

Better derived type compatibility checking

Treat externals as if implicitly interfaced

Extend IEEE_EXCEPTIONS module so tests still pass with argument checking

SAME_TYPE_AS and EXTENDS_TYPE_OF intrinsic inquiry functions

Define interfaces for most intrinsic subroutines

Better PASS arguments

More with PASS() argument

Prep for review

address comments

fix comment

Remove formatted expression from specification expression error message per review

more review comments

Original-commit: flang-compiler/f18@3cca775da9
Reviewed-on: https://github.com/flang-compiler/f18/pull/776
2019-10-07 11:01:46 -07:00
Peter Klausler 143fe79383 [flang] Merge pull request flang-compiler/f18#777 from flang-compiler/pmk-pp-tests
Import preprocessing tests

Original-commit: flang-compiler/f18@98f1b5f60b
Reviewed-on: https://github.com/flang-compiler/f18/pull/777
2019-10-07 09:40:47 -07:00
peter klausler d6c8bd805f [flang] Import preprocessing tests
Original-commit: flang-compiler/f18@7ef7029604
Reviewed-on: https://github.com/flang-compiler/f18/pull/777
2019-10-04 15:21:31 -07:00
Steve Scalpone c56e082120 [flang] Merge pull request flang-compiler/f18#775 from flang-compiler/pmk-fix
Fix flang-compiler/f18#773: ambiguous REALA=3 should be an assignment, not a declaration

Original-commit: flang-compiler/f18@adbb8becda
Reviewed-on: https://github.com/flang-compiler/f18/pull/775
2019-10-03 10:59:31 -07:00
peter klausler 78d33b600e [flang] Fix flang-compiler/f18#773
Original-commit: flang-compiler/f18@d12d1129b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/775
2019-10-02 15:42:07 -07:00
Steve Scalpone 019627ebd7 [flang] Merge pull request flang-compiler/f18#774 from flang-compiler/pmk-more-warnings
Enable clang warnings used by LLVM

Original-commit: flang-compiler/f18@c098156735
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
2019-10-03 10:59:14 -07:00
peter klausler 9b37989e05 [flang] Final tweaks
Original-commit: flang-compiler/f18@6e269b4e29
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
2019-10-02 16:52:27 -07:00
peter klausler 07d48c0a23 [flang] Extend documentation
Original-commit: flang-compiler/f18@7e11f8165f
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
2019-10-02 16:30:36 -07:00
peter klausler e88bf15d2a [flang] Dodge weird clang-format behavior
Original-commit: flang-compiler/f18@48b81a2dd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
2019-10-02 16:14:01 -07:00
peter klausler 4ee37ac356 [flang] Address review comments
Original-commit: flang-compiler/f18@b2a0503614
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
2019-10-02 15:48:20 -07:00
peter klausler 5c35f3288a [flang] Retain no-op default: cases when compiling with gcc
Original-commit: flang-compiler/f18@8ebfd8d2e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
2019-10-02 14:24:44 -07:00
peter klausler 637b933202 [flang] Enable more warnings, clean them up
Original-commit: flang-compiler/f18@c6b3420e5f
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
2019-10-02 12:40:52 -07:00
Steve Scalpone 1c2cb4bfe5 [flang] Merge pull request flang-compiler/f18#772 from DavidTruby/dist-schedule
Make the second argument to dist_schedule optional.

Original-commit: flang-compiler/f18@ff8dde78e6
Reviewed-on: https://github.com/flang-compiler/f18/pull/772
2019-10-03 10:58:45 -07:00
David Truby e401082289 [flang] Removed stray comma in unparse for dist_schedule clause
Original-commit: flang-compiler/f18@0b61bc22c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/772
2019-10-03 10:59:17 +01:00
David Truby 9aa80d3353 [flang] Make the second argument to dist_schedule optional.
Original-commit: flang-compiler/f18@7ed2d0e3ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/772
Tree-same-pre-rewrite: false
2019-10-02 16:58:11 +01:00
Steve Scalpone 7292b3334c [flang] Merge pull request flang-compiler/f18#771 from DavidTruby/distribute
Added basic sema checks for distribute construct

Original-commit: flang-compiler/f18@3aeb44b3a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/771
2019-10-03 10:58:24 -07:00
David Truby 56efc1eca2 [flang] Added basic sema checks for distribute construct
Original-commit: flang-compiler/f18@f23059bf30
Reviewed-on: https://github.com/flang-compiler/f18/pull/771
2019-10-02 16:13:32 +01:00
Steve Scalpone 9253f3c035 [flang] Merge pull request flang-compiler/f18#767 from DavidTruby/generic-fp
Replace access through union with reinterpret_cast.

Original-commit: flang-compiler/f18@f7d8318b56
Reviewed-on: https://github.com/flang-compiler/f18/pull/767
2019-10-03 10:57:46 -07:00
David Truby 98223835c0 [flang] Added comment about gcc function cast workaround.
Original-commit: flang-compiler/f18@28bc021323
Reviewed-on: https://github.com/flang-compiler/f18/pull/767
2019-10-01 11:15:43 +01:00