platform/upstream/llvm.git
4 years ago[flang] [OpenMP] Predetermined rules for loop index variables (flang-compiler/f18...
Jinxin (Brian) Yang [Wed, 5 Feb 2020 18:13:43 +0000 (10:13 -0800)]
[flang] [OpenMP] Predetermined rules for loop index variables (flang-compiler/f18#962)

This refers to three rules in OpenMP 4.5 Spec 2.15.1.1:
  * The loop iteration variable(s) in the associated do-loop(s) of a do,
    parallel do, taskloop, or distribute construct is (are) private.
  * The loop iteration variable in the associated do-loop of a simd
    construct with just one associated do-loop is linear with a linear-step
    that is the increment of the associated do-loop.
  * The loop iteration variables in the associated do-loops of a simd
    construct with multiple associated do-loops are lastprivate.

A simple example:
```
implicit none
  integer :: N = 1024
  integer i, j, k
  !$omp parallel do collapse(3)
  do i=1, N  <- i is private
     do j=1, N  <- j is private
        do k=1, N  <- k is private
        enddo
     enddo
  enddo
end
```

If `collapse` clause is not present, the associated do-loop for construct
`parallel do` is only `i` loop. With `collapse(n)`, `i`, `j`, and `k` are
all associated do-loops and the loop index variables are private to the
OpenMP construct:

```
implicit none
 !DEF: /MainProgram1/n ObjectEntity INTEGER(4)
 integer :: n = 1024
 !DEF: /MainProgram1/i ObjectEntity INTEGER(4)
 !DEF: /MainProgram1/j ObjectEntity INTEGER(4)
 !DEF: /MainProgram1/k ObjectEntity INTEGER(4)
 integer i, j, k
!$omp parallel do  collapse(3)
 !DEF: /MainProgram1/Block1/i (OmpPrivate) HostAssoc INTEGER(4)
 !REF: /MainProgram1/n
 do i=1,n
  !DEF: /MainProgram1/Block1/j (OmpPrivate) HostAssoc INTEGER(4)
  !REF: /MainProgram1/n
  do j=1,n
   !DEF: /MainProgram1/Block1/k (OmpPrivate) HostAssoc INTEGER(4)
   !REF: /MainProgram1/n
   do k=1,n
   end do
  end do
 end do
end program
```

This implementation assumes that the structural checks for do-loops
are done at this point, for example the `n` in `collapse(n)` should
be no more than the number of actual perfectly nested do-loops, etc..

Original-commit: flang-compiler/f18@572a57d3d0d785bb3f2aad9e890ef498c1214309
Reviewed-on: https://github.com/flang-compiler/f18/pull/962

4 years ago[flang] Merge pull request flang-compiler/f18#968 from flang-compiler/jpr-fix-clang...
jeanPerier [Wed, 5 Feb 2020 10:46:52 +0000 (02:46 -0800)]
[flang] Merge pull request flang-compiler/f18#968 from flang-compiler/jpr-fix-clang-template-step-limit

Fix template step limit issue with clang

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

4 years ago[flang] Fix template step limit issue with clang
Jean Perier [Tue, 4 Feb 2020 18:30:16 +0000 (10:30 -0800)]
[flang] Fix template step limit issue with clang

While working on PR 959, I instanciated a `common::TupleToVariant`
with ~50+ types inside the tuple. Clang would then crash after
1hr compilation with message:
"constexpr evaluation hit maximum step limit; possible infinite loop"
After investigating, it turned out clang handles very badly the way
`common::AreTypesDistinctHelper` was implemented.
Its "number of steps" was exponential with the number of types.
This fix makes this number quadratic which solves the issue.

Original-commit: flang-compiler/f18@4542cb57082eaf578799c76482d4b706ae5da077
Reviewed-on: https://github.com/flang-compiler/f18/pull/968

4 years ago[flang] Merge pull request flang-compiler/f18#950 from flang-compiler/pmk-frame
Peter Klausler [Tue, 4 Feb 2020 22:47:02 +0000 (14:47 -0800)]
[flang] Merge pull request flang-compiler/f18#950 from flang-compiler/pmk-frame

Formatted output editing & initial buffer framing code

Original-commit: flang-compiler/f18@003b664229a91b1692b52014ef6f9c9b65119b0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/950

4 years ago[flang] Initial buffer framing code
peter klausler [Fri, 24 Jan 2020 00:59:27 +0000 (16:59 -0800)]
[flang] Initial buffer framing code

Address review comments

Integer output data editing (I,B,O,Z)

Full integer output formatting

Stub out some work in progress

Progress on E output data editing

E, D, EN, and ES output editing done

Fw.d output editing

Real G output editing

G output editing for reals

Make environment a distinct module

CHARACTER and LOGICAL output editing

Minimal decimal representations for E0, F0, G0 editing

Move real output editing code into its own file

Fix/dodge some GCC build problems

Prep work for external I/O statement state

External HELLO, WORLD

Fix build problem with GCC

Add virtual destructors where needed

Add new test

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

4 years ago[flang] Merge pull request flang-compiler/f18#939 from flang-compiler/ps-dev-story
psteinfeld [Mon, 3 Feb 2020 17:28:49 +0000 (09:28 -0800)]
[flang] Merge pull request flang-compiler/f18#939 from flang-compiler/ps-dev-story

Explanation of how to implement a semantic check

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

4 years ago[flang] Explanation of how to implement a semantic check
Pete Steinfeld [Thu, 16 Jan 2020 00:25:26 +0000 (16:25 -0800)]
[flang] Explanation of how to implement a semantic check

This is the story of implementing semantic checks for passing DO
variables to functions with dummy arguments with INTENT(OUT) or
INTENT(INOUT).

Original-commit: flang-compiler/f18@889f90913f280f285eb9960a0e0baadfd43a555f
Reviewed-on: https://github.com/flang-compiler/f18/pull/939

4 years ago[flang] Merge pull request flang-compiler/f18#961 from flang-compiler/tsk-contig2
Tim Keith [Thu, 30 Jan 2020 00:17:41 +0000 (16:17 -0800)]
[flang] Merge pull request flang-compiler/f18#961 from flang-compiler/tsk-contig2

Fix another bug checking simple contiguity

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

4 years ago[flang] Fix another bug checking simple contiguity
Tim Keith [Tue, 28 Jan 2020 23:06:03 +0000 (15:06 -0800)]
[flang] Fix another bug checking simple contiguity

The test still wasn't correct for structure components. If the last
part-ref is a non-array or a single array element, but the whole
ArrayRef has non-zero rank, it is not contiguous. Otherwise, if there
are subscripts on the last part-ref they can be checked normally.

Add some tests for cases that were previously failing, and also for
cases with vector subscripts.

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

4 years ago[flang] Merge pull request flang-compiler/f18#954 from flang-compiler/ps-impure-final
psteinfeld [Wed, 29 Jan 2020 21:19:22 +0000 (13:19 -0800)]
[flang] Merge pull request flang-compiler/f18#954 from flang-compiler/ps-impure-final

Semantic checks for deallocating entities with IMPURE FINAL procedures

Original-commit: flang-compiler/f18@61da1f9e5c59cedb02026954a73ab30d8319a66c
Reviewed-on: https://github.com/flang-compiler/f18/pull/954

4 years ago[flang] Semantic checks for deallocating entities with IMPURE FINAL procedures
Pete Steinfeld [Mon, 27 Jan 2020 22:12:35 +0000 (14:12 -0800)]
[flang] Semantic checks for deallocating entities with IMPURE FINAL procedures

You cannot call an IMPURE procedure in a DO CONCURRENT construct.  One
way that can happen is if an entity with an IMPURE FINAL procedure gets
deallocated.  Similar to the checks for deallocating coarrays, there are
three ways that an entity can get deallocated that are applicable to DO
CONCURRENT constructs -- an actual DEALLOCATE statement, block exit, and
assignment.

This change depends on the utility function `HasImpureFinal()` in tools.h to
determine if an entity has a derived type with an IMPURE FINAL
procedure.  In the course of testing this change, I realized that this
check is incorrect, but the code specific to DO CONCURRENT is
independent of the check, so I might as well implement it.

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

4 years ago[flang] Merge pull request flang-compiler/f18#960 from flang-compiler/by-remove-default
Jinxin (Brian) Yang [Tue, 28 Jan 2020 22:12:14 +0000 (14:12 -0800)]
[flang] Merge pull request flang-compiler/f18#960 from flang-compiler/by-remove-default

Remove `default` case for OmpSectionsDirective (only two enum values)

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

4 years ago[flang] Remove `default` case for OmpSectionsDirective (only two enum values)
Jinxin Yang [Tue, 28 Jan 2020 21:58:14 +0000 (13:58 -0800)]
[flang] Remove `default` case for OmpSectionsDirective (only two enum values)

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

4 years ago[flang] [OpenMP] Name Resolution for OpenMP constructs (flang-compiler/f18#940)
Jinxin (Brian) Yang [Tue, 28 Jan 2020 20:51:35 +0000 (12:51 -0800)]
[flang] [OpenMP] Name Resolution for OpenMP constructs (flang-compiler/f18#940)

This is an extended framework based on the previous work that addresses
the NR on OpenMP directives/clauses (b2ea520). In this change:
  * New `OmpVisitor` is created (ResolveNamesVisitor derives from it) to
    create necessary scopes for certain OpenMP constructs. This is along
    with the regular Fortran NR process.
  * Old `OmpVisitor` is adjusted and converted to a standalone visitor--
    `OmpAttributeVisitor`. This is used to walk through the OpenMP constructs
    and do the NR for variables on the OpenMP directives or data references
    within the OpenMP constructs. "Do the NR" here means that based on the NR
    results of the regular Fortran NR, fix the symbols of `Names` related
    to the OpenMP constructs. Note that there is an `OmpContext` in this
    visitor (similar to the one in `OmpStructureChecker`), this is necessary
    when dealing with the nested OpenMP constructs in the future.

Given an OpenMP code:
```
real*8 a, b
  a = 1.
  b = 2.
  !$omp parallel private(a)
  a = 3.
  b = 4.
  !$omp end parallel
  print *, a, b
end
```

w/o -fopenmp:
```
real*8 a, b
 !REF: /MainProgram1/a
 a = 1.
 !REF: /MainProgram1/b
 b = 2.
 !!!! OMP parallel
 !REF: /MainProgram1/a
 a = 3.
 !REF: /MainProgram1/b
 b = 4.
 !!!! OMP end parallel
 !REF: /MainProgram1/a
 !REF: /MainProgram1/b
 print *, a, b
end
```

w/ -fopenmp:
```
real*8 a, b
 !REF: /MainProgram1/a
 a = 1.
 !REF: /MainProgram1/b
 b = 2.
!$omp parallel  private(a)   <-- new Symbol for 'a' created
 !DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(8)
 a = 3.   <-- fix the old symbol with new Symbol in parallel scope
 !REF: /MainProgram1/b
 b = 4.   <-- do nothing because by default it is shared in this scope
!$omp end parallel
 !REF: /MainProgram1/a
 !REF: /MainProgram1/b
 print *, a, b
end
```

Please note that this is a framework update, there are still many
things on the TODO list for finishing the NR for OpenMP (based on
the `OpenMP-semantics.md` design doc), which will be on top of this
framework.

Some TODO items:
- Create a generic function to go through all the rules for deciding
  `predetermined`, `explicitly determined`, and `implicitly determined`
  data-sharing attributes. (This is the next biggest part)
- Handle `Array Sections` and `Array or Structure Element`.
- Take association into consideration for example Pointer association,
  `ASSOCIATE` construct, and etc.
- Handle all the name resolution for directives/clauses that have
  `parser::Name`.

* N.B. Extend `AddSourceRange` to apply to current and parent scopes
  - motivated by a few cases that need to call `AddSourceRange`
    for current & parent scopes; the extension should be safe
  - global scope is not included

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

4 years ago[flang] Merge pull request flang-compiler/f18#956 from flang-compiler/ps-checklist
psteinfeld [Tue, 28 Jan 2020 04:18:52 +0000 (20:18 -0800)]
[flang] Merge pull request flang-compiler/f18#956 from flang-compiler/ps-checklist

More checklist items

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

4 years ago[flang] More checklist items
Pete Steinfeld [Fri, 24 Jan 2020 20:08:24 +0000 (12:08 -0800)]
[flang] More checklist items

I added more items when reviewing some actual pull request comments.

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

4 years ago[flang] Changed *.cc file extension to *.cpp (updated scripts) (flang-compiler/f18...
Alexis Perry [Tue, 28 Jan 2020 02:18:45 +0000 (19:18 -0700)]
[flang] Changed *.cc file extension to *.cpp (updated scripts) (flang-compiler/f18#958)

Updated CMake files accordingly, using better regex
Updated license headers to match new extension and fit within 80 columns
Updated other comments within files that referred to the old extension

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

4 years ago[flang] Moved public headers to include/flang (flang-compiler/f18#943)
David Truby [Mon, 27 Jan 2020 20:57:59 +0000 (20:57 +0000)]
[flang] Moved public headers to include/flang (flang-compiler/f18#943)

Original-commit: flang-compiler/f18@21adbc7e05b2454ba3fc725b4697748f98599471
Reviewed-on: https://github.com/flang-compiler/f18/pull/943

4 years ago[flang] Merge pull request flang-compiler/f18#951 from flang-compiler/tsk-impure
Tim Keith [Mon, 27 Jan 2020 19:53:53 +0000 (11:53 -0800)]
[flang] Merge pull request flang-compiler/f18#951 from flang-compiler/tsk-impure

Fix bugs detecting impure calls

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

4 years ago[flang] Fix bugs detecting impure calls
Tim Keith [Sat, 25 Jan 2020 16:15:17 +0000 (08:15 -0800)]
[flang] Fix bugs detecting impure calls

Change Traverse to visit the actual arguments of structure constructors.

Change FindImpureCallHelper to visit the actual arguments of a call to a
pure procedure in case one of them makes a call to an impure function.

Original-commit: flang-compiler/f18@81a5488ee62b4324d002c348464712c930095a32
Reviewed-on: https://github.com/flang-compiler/f18/pull/951

4 years ago[flang] Merge pull request flang-compiler/f18#952 from flang-compiler/tsk-contig
Tim Keith [Mon, 27 Jan 2020 19:53:31 +0000 (11:53 -0800)]
[flang] Merge pull request flang-compiler/f18#952 from flang-compiler/tsk-contig

Fix bug detecting simply contiguous component

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

4 years ago[flang] Fix bug detecting simply contiguous component
Tim Keith [Sun, 26 Jan 2020 18:42:34 +0000 (10:42 -0800)]
[flang] Fix bug detecting simply contiguous component

We were always return false when testing a component for simple
contiguity. Change to check that the component is an array that is
simply continguous. Also treat a scalar component of scalar as simply
contiguous.

A pointer with bounds remapping to a complex part is a similar case
so add a test for that too.

Original-commit: flang-compiler/f18@27d76da2a44614b2c4cf4d576410372cabf66577
Reviewed-on: https://github.com/flang-compiler/f18/pull/952

4 years ago[flang] Merge pull request flang-compiler/f18#949 from flang-compiler/pmk-file
Peter Klausler [Mon, 27 Jan 2020 18:01:32 +0000 (10:01 -0800)]
[flang] Merge pull request flang-compiler/f18#949 from flang-compiler/pmk-file

OpenFile class: API and implementation wrappers for open external files

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

4 years ago[flang] Basic file operation wrapper
peter klausler [Fri, 24 Jan 2020 00:10:00 +0000 (16:10 -0800)]
[flang] Basic file operation wrapper

Asynchronous interfaces and locking

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

4 years ago[flang] Merge pull request flang-compiler/f18#946 from flang-compiler/pmk-hello
Peter Klausler [Fri, 24 Jan 2020 20:35:43 +0000 (12:35 -0800)]
[flang] Merge pull request flang-compiler/f18#946 from flang-compiler/pmk-hello

12HHELLO, WORLD

Original-commit: flang-compiler/f18@3087aa82840b817cb7433c48cc2310accf9dc9b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/946

4 years ago[flang] Drill down to a working implementation of the APIs for an
peter klausler [Thu, 16 Jan 2020 21:51:25 +0000 (13:51 -0800)]
[flang] Drill down to a working implementation of the APIs for an
internal formatted WRITE with no data list items.

Improve argument names in io-api.h

Bump up error number to not conflict with errno values

Use Fortran::runtime::io namespace

Add wrapper around malloc/free, allow use of unique_ptr with wrapper

IoErrorHandler

Revamp FormatContext, use virtual member functions

Update comment syntax, allow for old C

12HHELLO, WORLD

Remove files not yet ready for review

Use std::forward

Fix gcc build warnings

Fix redundant filename in license boilerplate

Reduce runtime dependence on compiler binary libraries, fixing shared lib builds

Original-commit: flang-compiler/f18@839a91f1d699cd839767407bcdb1e384f2d2b730
Reviewed-on: https://github.com/flang-compiler/f18/pull/946

4 years ago[flang] Merge pull request flang-compiler/f18#944 from flang-compiler/tsk-pointer
Tim Keith [Wed, 22 Jan 2020 21:50:42 +0000 (13:50 -0800)]
[flang] Merge pull request flang-compiler/f18#944 from flang-compiler/tsk-pointer

Check bounds on pointer assignment

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

4 years ago[flang] Check bounds on pointer assignment
Tim Keith [Wed, 22 Jan 2020 01:15:21 +0000 (17:15 -0800)]
[flang] Check bounds on pointer assignment

Perform checks on bounds-spec and bounds-remapping in a pointer
assignment statement:
- check that the rank of the bounds specified matches the rank of the
  pointer
- for bounds-spec, check that the pointer rank matches the target rank
- for bounds-remapping:
  - check that the target is rank 1 or simply contiguous
  - check that there are sufficient elements on the RHS for the bounds
    specified, when it can be determined at compile time

Move more of the pointer-specific checking from `assignment.cc`
to `pointer-assignment.cc`.

Original-commit: flang-compiler/f18@7489b3539224f8ad7a55873916e5854510236218
Reviewed-on: https://github.com/flang-compiler/f18/pull/944

4 years ago[flang] Refactor Analyze(PointerAssignmentStmt)
Tim Keith [Thu, 16 Jan 2020 20:43:48 +0000 (12:43 -0800)]
[flang] Refactor Analyze(PointerAssignmentStmt)

Use early returns to reduce the indentation.
Check LHS is a pointer as early as possible.
A PointerAssignmentStmt can only have a typedAssignment that
represents a PointerAssignment. So assert that is the case and
don't worry about the other cases.

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

4 years ago[flang] Make GenericAssignmentWrapper more like GenericExprWrapper
Tim Keith [Wed, 15 Jan 2020 01:39:29 +0000 (17:39 -0800)]
[flang] Make GenericAssignmentWrapper more like GenericExprWrapper

Have it wrap an optional Assignment so that we can distinguish between
unanalyzed and analyzed with error.

Change analysis of PointerAssignmentStmt to proceed with bounds even
if the DataRef or Expr has an error. Otherwise any bounds expressions
won't be analyzed in that case.

In GetExpr() and GetAssignment() if we get an internal error due to an
unanalyzed expression, dump the parse tree for the expression so we have
some context for the error. They should only be called after the
expression analysis phase. At that point, every expression and assignment
should be analyzed, though some may have resulted in errors(indicated by
returning `nullptr`).

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

4 years ago[flang] Add `std::string ExpressionBase::AsFortran()`
Tim Keith [Wed, 15 Jan 2020 01:31:25 +0000 (17:31 -0800)]
[flang] Add `std::string ExpressionBase::AsFortran()`

This is easier to use when including an expression in an error message
and also useful when debugging for dumping expressions.

Fix up several places that no longer need to use a temporary
std::stringstream.

Also change some references to `operator<<` in `formatting.cc` and
`symbol.cc` that became ambiguous with this change.

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

4 years ago[flang] Merge pull request flang-compiler/f18#936 from flang-compiler/ps-checklist
psteinfeld [Wed, 22 Jan 2020 17:43:44 +0000 (09:43 -0800)]
[flang] Merge pull request flang-compiler/f18#936 from flang-compiler/ps-checklist

Checklist to precede pull requests

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

4 years ago[flang] Checklist to precede pull requests
Pete Steinfeld [Sun, 12 Jan 2020 19:24:13 +0000 (11:24 -0800)]
[flang] Checklist to precede pull requests

I added a checklist to the C++ Style document for things to check before
submitting a pull request or when responding to a request for comments
on a pull request.

Original-commit: flang-compiler/f18@903420268a5aabbab9acdf8788b4344c395ee597
Reviewed-on: https://github.com/flang-compiler/f18/pull/936

4 years ago[flang] Merge pull request flang-compiler/f18#938 from flang-compiler/pmk-fix-rank
Peter Klausler [Wed, 15 Jan 2020 23:58:00 +0000 (15:58 -0800)]
[flang] Merge pull request flang-compiler/f18#938 from flang-compiler/pmk-fix-rank

Fix shape analysis of RHS designators of pointer assignments

Original-commit: flang-compiler/f18@0423347d69e4422e080a59dfec00c850bf1ddcc2
Reviewed-on: https://github.com/flang-compiler/f18/pull/938

4 years ago[flang] Fix shape analysis of RHS designators of pointer assignments
peter klausler [Wed, 15 Jan 2020 22:11:48 +0000 (14:11 -0800)]
[flang] Fix shape analysis of RHS designators of pointer assignments

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

4 years ago[flang] Merge pull request flang-compiler/f18#937 from flang-compiler/tsk-pointer
Tim Keith [Wed, 15 Jan 2020 23:01:01 +0000 (15:01 -0800)]
[flang] Merge pull request flang-compiler/f18#937 from flang-compiler/tsk-pointer

Fix checking of pointer target with association

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

4 years ago[flang] Fix checking of pointer target with association
Tim Keith [Wed, 15 Jan 2020 21:43:05 +0000 (13:43 -0800)]
[flang] Fix checking of pointer target with association

When checking if the target of a pointer assignment is valid, we
weren't following associations. E.g. we complained about the assignment
below if `b` had the TARGET attribute but `c` did not:
```
associate(a => b%c)
  p => a
end associate
```

The fix is to change `GetSymbolVector()` to follow associations in
creating the chain of symbols from a designator.

Add tests for this, and also some other cases where TARGET is on the
derived type variable rather than the component (which worked but didn't
have tests).

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

4 years ago[flang] Merge pull request flang-compiler/f18#927 from flang-compiler/pmk-format
Peter Klausler [Wed, 15 Jan 2020 22:08:24 +0000 (14:08 -0800)]
[flang] Merge pull request flang-compiler/f18#927 from flang-compiler/pmk-format

Runtime FORMAT scanning

Original-commit: flang-compiler/f18@538d4a1dea9d2301fe36b13d1b248fde5c010f83
Reviewed-on: https://github.com/flang-compiler/f18/pull/927

4 years ago[flang] begin processing format strings
peter klausler [Thu, 9 Jan 2020 16:10:57 +0000 (08:10 -0800)]
[flang] begin processing format strings

Move RoundingMode to Fortran.h

Always skip blanks outside character literals & Hollerith

Templatize

optimize repeat counts somewhat

Fix license punctuation, remove patch

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

4 years ago[flang] Merge pull request flang-compiler/f18#926 from flang-compiler/pmk-bd
Peter Klausler [Wed, 15 Jan 2020 19:14:53 +0000 (11:14 -0800)]
[flang] Merge pull request flang-compiler/f18#926 from flang-compiler/pmk-bd

BLOCK DATA semantics

Original-commit: flang-compiler/f18@4954b95527a48d5242731c91a7181a001bf64283
Reviewed-on: https://github.com/flang-compiler/f18/pull/926

4 years ago[flang] Comments
peter klausler [Wed, 15 Jan 2020 00:16:32 +0000 (16:16 -0800)]
[flang] Comments

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

4 years ago[flang] Better EQUIVALENCE handling
peter klausler [Tue, 14 Jan 2020 23:59:29 +0000 (15:59 -0800)]
[flang] Better EQUIVALENCE handling

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

4 years ago[flang] Better fix; clean up redundant utilities
peter klausler [Tue, 14 Jan 2020 23:08:37 +0000 (15:08 -0800)]
[flang] Better fix; clean up redundant utilities

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

4 years ago[flang] Fix unrelated build error found in testing
peter klausler [Tue, 14 Jan 2020 22:19:42 +0000 (14:19 -0800)]
[flang] Fix unrelated build error found in testing

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

4 years ago[flang] Update a test
peter klausler [Tue, 14 Jan 2020 19:38:09 +0000 (11:38 -0800)]
[flang] Update a test

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

4 years ago[flang] Address review comments
peter klausler [Tue, 14 Jan 2020 19:24:49 +0000 (11:24 -0800)]
[flang] Address review comments

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

4 years ago[flang] Better check for variables in DATA
peter klausler [Tue, 14 Jan 2020 19:11:15 +0000 (11:11 -0800)]
[flang] Better check for variables in DATA

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

4 years ago[flang] Fix bug
peter klausler [Mon, 13 Jan 2020 23:39:18 +0000 (15:39 -0800)]
[flang] Fix bug

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

4 years ago[flang] More comments addressed
peter klausler [Mon, 13 Jan 2020 23:13:09 +0000 (15:13 -0800)]
[flang] More comments addressed

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

4 years ago[flang] Address review comments
peter klausler [Mon, 13 Jan 2020 22:30:31 +0000 (14:30 -0800)]
[flang] Address review comments

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

4 years ago[flang] BLOCK DATA
peter klausler [Fri, 10 Jan 2020 01:12:46 +0000 (17:12 -0800)]
[flang] BLOCK DATA

add test

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

4 years ago[flang] Merge pull request flang-compiler/f18#928 from flang-compiler/tsk-assignment3
Tim Keith [Tue, 14 Jan 2020 21:09:08 +0000 (13:09 -0800)]
[flang] Merge pull request flang-compiler/f18#928 from flang-compiler/tsk-assignment3

Pointer assignment semantic checks

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

4 years ago[flang] Pointer assignment semantic checks
Tim Keith [Tue, 14 Jan 2020 00:39:00 +0000 (16:39 -0800)]
[flang] Pointer assignment semantic checks

Call `CheckPointerAssignment()` when analyzing a pointer assignment
statement. NOTE: the cases with bounds-spec and bounds-remapping are
still to be done.

Perform checks on pointer symbols in `check-declarations.cc`.

Check for pointer to generic intrinsic in `semantics/expression.cc`.

Add the other required pointer assignment checks to `pointer-assignment.cc`.

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

4 years ago[flang] C1027: procedure pointer may not be coindexed object
Tim Keith [Mon, 13 Jan 2020 23:41:23 +0000 (15:41 -0800)]
[flang] C1027: procedure pointer may not be coindexed object

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

4 years ago[flang] Add IntrinsicProcTable::IsSpecificIntrinsicFunction
Tim Keith [Mon, 6 Jan 2020 23:56:32 +0000 (15:56 -0800)]
[flang] Add IntrinsicProcTable::IsSpecificIntrinsicFunction

This replaces IsUnrestrictedSpecificIntrinsicFunction and returns
information that allows the caller to distinguish between restricted
and unrestricted intrinsics.

The new case in `resolve46.f90` used to get an internal error.

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

4 years ago[flang] Make Fortran form of intrinsic types uppercase
Tim Keith [Mon, 6 Jan 2020 22:04:17 +0000 (14:04 -0800)]
[flang] Make Fortran form of intrinsic types uppercase

`DynamicType::AsFortran` was using mixed case for intrinic type names.
Make it upper case for consistency with TYPE(...) and CHARACTER when a
length is present and other error messages.

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

4 years ago[flang] Move pointer assignment checking to its own file
Tim Keith [Mon, 6 Jan 2020 17:16:18 +0000 (09:16 -0800)]
[flang] Move pointer assignment checking to its own file

Create `pointer-assignment.{h,cc}` for pointer assignment checking.
It doesn't share with assignment checking so it should be its own file.
Move the code into semantics namespace.

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

4 years ago[flang] Clean up AssignmentContext
Tim Keith [Sat, 4 Jan 2020 20:38:35 +0000 (12:38 -0800)]
[flang] Clean up AssignmentContext

Eliminate `at_` and use location from `SemanticsContext` instead.

Add and use Analyze functions for `std::optional` and `std::list`.

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

4 years ago[flang] Merge pull request flang-compiler/f18#933 from flang-compiler/tsk-issues
Tim Keith [Tue, 14 Jan 2020 21:06:06 +0000 (13:06 -0800)]
[flang] Merge pull request flang-compiler/f18#933 from flang-compiler/tsk-issues

Move checks for valid array-spec to check-declarations.cc

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

4 years ago[flang] Move checks for valid array-spec to check-declarations.cc
Tim Keith [Tue, 14 Jan 2020 20:06:52 +0000 (12:06 -0800)]
[flang] Move checks for valid array-spec to check-declarations.cc

At the time we finish processing an array-spec in `resolve-names.cc`,
we don't know if the entity is going to be declared ALLOCATABLE later
so we can't check for validity there. In the new test in `resolve58.f90`
(based on issue flang-compiler/f18#930) we were reporting an error on `b` and not on `a`
when it should be the reverse.

The fix is to move array-spec checking to `check-declarations.cc`,
after name resolution is complete.

Fixes flang-compiler/f18#930.

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

4 years ago[flang] Merge pull request flang-compiler/f18#932 from flang-compiler/pmk-fix-931
Peter Klausler [Tue, 14 Jan 2020 19:37:20 +0000 (11:37 -0800)]
[flang] Merge pull request flang-compiler/f18#932 from flang-compiler/pmk-fix-931

Fix bug flang-compiler/f18#931: spurious error reported on CSHIFT

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

4 years ago[flang] Fix bug flang-compiler/f18#931: spurious error reported on CSHIFT
peter klausler [Tue, 14 Jan 2020 18:53:36 +0000 (10:53 -0800)]
[flang] Fix bug flang-compiler/f18#931: spurious error reported on CSHIFT

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

4 years ago[flang] Regression tests configuration for f18 repository (flang-compiler/f18#861)
CarolineConcatto [Tue, 14 Jan 2020 16:20:49 +0000 (16:20 +0000)]
[flang] Regression tests configuration for f18 repository (flang-compiler/f18#861)

The configuration for the tests are in lit.* files.
The lit tests rely on the presence of llvm-lit,FileCheck, not and  count.
When building LLVM add:
-DLLVM_INSTALL_UTILS=On at the cmake command.
LLVM_LIT is found by setting LLVM_EXTERNAL_LIT in f18 CMakeLists.txt.

This patch:
  * Uses LLVM_EXTERNAL_LIT
  * Adds regression tests configurations
  * Adds a proof of concept regression test

The regression test needs to have the Utils build in LLVM.
This is done by adding:
  -DLLVM_INSTALL_UTILS=On
to the LLVM build cmake.

Signed-off-by: Caroline Concatto <caroline.concatto@arm.com>
Original-commit: flang-compiler/f18@a58c6067a1ab5cd02dfb5b6fb9919a20b960d984
Reviewed-on: https://github.com/flang-compiler/f18/pull/861

4 years ago[flang] Outline operator<< for CharBlock. (flang-compiler/f18#916)
David Truby [Tue, 14 Jan 2020 06:08:56 +0000 (06:08 +0000)]
[flang] Outline operator<< for CharBlock. (flang-compiler/f18#916)

This fixes an issue where the Dump function definitions in dump.cc
were relying on the forward declaration of operator<< for CharBlock
which was marked inline and only present in char-block.h.

This is not allowed under section 6.2.10 of the C++17 standard, and
caused a compilation failure when building with clang 9 as this was
inlining every use of the function and therefore not generating an
outlined definition for linking.

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

4 years ago[flang] Merge pull request flang-compiler/f18#924 from flang-compiler/ps-cleanup...
psteinfeld [Sun, 12 Jan 2020 17:08:17 +0000 (09:08 -0800)]
[flang] Merge pull request flang-compiler/f18#924 from flang-compiler/ps-cleanup-do-check

Removed an unnecessary check after Tim fixed issue flang-compiler/f18#915.

Original-commit: flang-compiler/f18@538a6dd5e27e3a159b84cd167f46bbbf656c8cfe
Reviewed-on: https://github.com/flang-compiler/f18/pull/924

4 years ago[flang] Removed an unnecessary check after Tim fixed issue flang-compiler/f18#915.
Pete Steinfeld [Sun, 12 Jan 2020 16:31:54 +0000 (08:31 -0800)]
[flang] Removed an unnecessary check after Tim fixed issue flang-compiler/f18#915.

Original-commit: flang-compiler/f18@348b04bc1c313d5d18ebb133441967547d4c7d6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/924

4 years ago[flang] Merge pull request flang-compiler/f18#918 from flang-compiler/ps-do-func
psteinfeld [Fri, 10 Jan 2020 23:43:33 +0000 (15:43 -0800)]
[flang] Merge pull request flang-compiler/f18#918 from flang-compiler/ps-do-func

Checks for DO variables passed to INTENT(OUT) dummies in functions

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

4 years ago[flang] Checks for DO variables passed to INTENT(OUT) dummies in functions
Pete Steinfeld [Thu, 9 Jan 2020 19:37:51 +0000 (11:37 -0800)]
[flang] Checks for DO variables passed to INTENT(OUT) dummies in functions

I added a traveral framework to find actual arguments in expressions.
For arguments that are DO variables being passed to dummy arguments with
INTENT(OUT), I emit an error message.  For INTENT(INOUT), I emit a
warning.

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

4 years ago[flang] Merge pull request flang-compiler/f18#923 from flang-compiler/tsk-expr2
Tim Keith [Fri, 10 Jan 2020 22:52:36 +0000 (14:52 -0800)]
[flang] Merge pull request flang-compiler/f18#923 from flang-compiler/tsk-expr2

Detect incorrect use of assumed-type dummy arguments

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

4 years ago[flang] Detect incorrect use of assumed-type dummy arguments
Tim Keith [Fri, 10 Jan 2020 22:09:39 +0000 (14:09 -0800)]
[flang] Detect incorrect use of assumed-type dummy arguments

Assumed-type dummy arguments can only be used as actual arguments. If
they are used in other contexts it is an error. Change argument analysis
to handle these differently depending on the context. `allowAssumedType`
is set when the argument can be assumed-type. These expressions now all
get `typedExpr` set to `nullopt`.

Change `AnalyzeSectionSubscripts` to analyze all of the subscripts
even if one has an error. This ensures they all get analyzed expressions
(or `nullopt` in case of error).

Fix a bug analyzing `BoundsRemapping`: the lower bound was analyzed
twice and the upper bound not at all.

These change mean that `typedExpr` is set in all known cases.
Fixes flang-compiler/f18#915.

Original-commit: flang-compiler/f18@679ef69905e39f39454768264059afd85b615840
Reviewed-on: https://github.com/flang-compiler/f18/pull/923

4 years ago[flang] Merge pull request flang-compiler/f18#922 from flang-compiler/gak-fix-comments
Gary Klimowicz [Fri, 10 Jan 2020 21:05:23 +0000 (13:05 -0800)]
[flang] Merge pull request flang-compiler/f18#922 from flang-compiler/gak-fix-comments

Minor format change to LLVM license lines

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

4 years ago[flang] Minor format change to LLVM license lines
Gary Klimowicz [Fri, 10 Jan 2020 20:12:03 +0000 (12:12 -0800)]
[flang] Minor format change to LLVM license lines

Replace comment lines containing all dashes with the
proper ===-----....----=== markers.

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

4 years ago[flang] Merge pull request flang-compiler/f18#919 from flang-compiler/pmk-fix-power...
Peter Klausler [Fri, 10 Jan 2020 17:15:29 +0000 (09:15 -0800)]
[flang] Merge pull request flang-compiler/f18#919 from flang-compiler/pmk-fix-power-build

Dodge build problem in some Power environments

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

4 years ago[flang] Dodge build problem in some Power environments
peter klausler [Thu, 9 Jan 2020 22:01:40 +0000 (14:01 -0800)]
[flang] Dodge build problem in some Power environments

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

4 years ago[flang] Merge pull request flang-compiler/f18#914 from flang-compiler/pmk-runtime-1
Peter Klausler [Thu, 9 Jan 2020 21:07:34 +0000 (13:07 -0800)]
[flang] Merge pull request flang-compiler/f18#914 from flang-compiler/pmk-runtime-1

Start, stop, and error routines for runtime

Original-commit: flang-compiler/f18@42ff2d005242d71f80a9460c00cbcec3e8323971
Reviewed-on: https://github.com/flang-compiler/f18/pull/914

4 years ago[flang] Runtime starting and stopping
peter klausler [Wed, 8 Jan 2020 21:27:32 +0000 (13:27 -0800)]
[flang] Runtime starting and stopping

Define ImageTerminator as a mixin-able class

Turn start.cc into main.cc

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

4 years ago[flang] Merge pull request flang-compiler/f18#917 from flang-compiler/pmk-fix-912
Peter Klausler [Thu, 9 Jan 2020 20:28:39 +0000 (12:28 -0800)]
[flang] Merge pull request flang-compiler/f18#917 from flang-compiler/pmk-fix-912

Address complaints in bug flang-compiler/f18#912

Original-commit: flang-compiler/f18@66025c14e432ee3f2ceab9ad5176bd1c64cd147c
Reviewed-on: https://github.com/flang-compiler/f18/pull/917

4 years ago[flang] Address complaints in bug flang-compiler/f18#912
peter klausler [Thu, 9 Jan 2020 17:39:09 +0000 (09:39 -0800)]
[flang] Address complaints in bug flang-compiler/f18#912

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

4 years ago[flang] Merge pull request flang-compiler/f18#911 from flang-compiler/pmk-fold-trim
Peter Klausler [Wed, 8 Jan 2020 17:04:30 +0000 (09:04 -0800)]
[flang] Merge pull request flang-compiler/f18#911 from flang-compiler/pmk-fold-trim

Fold TRIM and (new intrinsic) IS_CONTIGUOUS

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

4 years ago[flang] Fold TRIM
peter klausler [Tue, 7 Jan 2020 21:39:42 +0000 (13:39 -0800)]
[flang] Fold TRIM

Accept IS_CONTIGUOUS and fold it

test folding is_contiguous

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

4 years ago[flang] Merge pull request flang-compiler/f18#910 from flang-compiler/pmk-fold-more
Peter Klausler [Tue, 7 Jan 2020 21:08:51 +0000 (13:08 -0800)]
[flang] Merge pull request flang-compiler/f18#910 from flang-compiler/pmk-fold-more

Fold more intrinsic functions

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

4 years ago[flang] Implement folding of INDEX, SCAN, & VERIFY
peter klausler [Mon, 6 Jan 2020 23:29:53 +0000 (15:29 -0800)]
[flang] Implement folding of INDEX, SCAN, & VERIFY

Fold LEN_TRIM

Fold REPEAT

Fix gcc build warning

Fix two tests that had illegal pointers to coarrays

Original-commit: flang-compiler/f18@36769996fa9559b84dda59f3f9eceee9d2269e74
Reviewed-on: https://github.com/flang-compiler/f18/pull/910

4 years ago[flang] Merge pull request flang-compiler/f18#907 from flang-compiler/pmk-enable...
Peter Klausler [Tue, 7 Jan 2020 19:42:20 +0000 (11:42 -0800)]
[flang] Merge pull request flang-compiler/f18#907 from flang-compiler/pmk-enable-semantics

Enable semantic analysis by default

Original-commit: flang-compiler/f18@26ab8745110bcd8909024bb02720cc0f23b9ed9b
Reviewed-on: https://github.com/flang-compiler/f18/pull/907

4 years ago[flang] enable semantic analysis by default
peter klausler [Sat, 4 Jan 2020 00:32:23 +0000 (16:32 -0800)]
[flang] enable semantic analysis by default

back out -Mnolargearray default temporarily

Fix C_F_POINTER(SHAPE=) argument check, it can be any kind of integer

Revert default result kind of SIZE() & al. to standard by default

Remove needless usage of -fdebug-semantics

Original-commit: flang-compiler/f18@57058a5b163eaa90c7e0f387ea4918f9efa8184c
Reviewed-on: https://github.com/flang-compiler/f18/pull/907

4 years ago[flang] Merge pull request flang-compiler/f18#897 from kiranchandramohan/critical-3
Peter Klausler [Sat, 4 Jan 2020 15:55:26 +0000 (07:55 -0800)]
[flang] Merge pull request flang-compiler/f18#897 from kiranchandramohan/critical-3

Semantic Checks for critical construct

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

4 years ago[flang] Semantic checks for critical construct
Kiran Chandramohan [Thu, 26 Dec 2019 05:18:47 +0000 (05:18 +0000)]
[flang] Semantic checks for critical construct

The commit includes the following,
-> The name field in DoConcurrent*Enforce classes are not used anymore.
Removing the field and its collection and retrieval from
DoConcurrentBodyEnforce and its usage in DoConcurrentLabelEnforce.
-> DoConcurrentLabelEnforce is useful for checking that there
are no branches escaping from other constructs also. For enabling
use in other constructs (like critical) moving this to tools.h
and renaming it as LabelEnforce.
-> Checks for the constraints.
-> Tests for the constaints.

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

4 years ago[flang] Merge pull request flang-compiler/f18#905 from flang-compiler/pmk-folding
Peter Klausler [Sat, 4 Jan 2020 00:22:18 +0000 (16:22 -0800)]
[flang] Merge pull request flang-compiler/f18#905 from flang-compiler/pmk-folding

Constant folding for ANINT, NINT, FLOOR, and CEILING intrinsic functions

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

4 years ago[flang] Fold FLOOR, CEILING, NINT, and ANINT
peter klausler [Fri, 3 Jan 2020 19:34:16 +0000 (11:34 -0800)]
[flang] Fold FLOOR, CEILING, NINT, and ANINT

Add GetUltimate() to ResolveAssociations(), fixing a UBOUND test case with use association

Fix folding of array-valued subscripts while I am in here

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

4 years ago[flang] Merge pull request flang-compiler/f18#906 from flang-compiler/pmk-fix
Peter Klausler [Fri, 3 Jan 2020 23:22:15 +0000 (15:22 -0800)]
[flang] Merge pull request flang-compiler/f18#906 from flang-compiler/pmk-fix

Another attempt to fix bug flang-compiler/f18#877

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

4 years ago[flang] Another attempt to fix bug flang-compiler/f18#877
peter klausler [Fri, 3 Jan 2020 21:15:18 +0000 (13:15 -0800)]
[flang] Another attempt to fix bug flang-compiler/f18#877

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

4 years ago[flang] Merge pull request flang-compiler/f18#904 from flang-compiler/tsk-assignment3
Tim Keith [Fri, 3 Jan 2020 22:11:14 +0000 (14:11 -0800)]
[flang] Merge pull request flang-compiler/f18#904 from flang-compiler/tsk-assignment3

Add analyzed form of pointer assignment

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

4 years ago[flang] Add analyzed form of pointer assignment
Tim Keith [Fri, 3 Jan 2020 18:38:51 +0000 (10:38 -0800)]
[flang] Add analyzed form of pointer assignment

Add `typedAssignment` to `PointerAssignmentStmt` parse tree node and
extend `evaluate::Assignment` to include pointer assignment, including
analyzed bounds. Analyze pointer assignments and fill those in.
Emit them in unparsed output and parse tree dump when present.

Change assignment checking to use analyzed expressions and assignments
rather than calling AnalyzeExpr. Check bounds in pointer assignments
for impure function calls in FORALL context.

Add `Fold` convenience function to `ExpressionAnalyzer`.

Original-commit: flang-compiler/f18@140c983423d3f49fad66bc67317af3684e96ba1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/904

4 years ago[flang] Use common SymbolSet type
Tim Keith [Fri, 27 Dec 2019 17:02:28 +0000 (09:02 -0800)]
[flang] Use common SymbolSet type

Replace `std::set<const Symbol *>` with `SymbolSet` from `symbol.h`.

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

4 years ago[flang] Fix type resolution in ConcurrentHeader
Tim Keith [Mon, 23 Dec 2019 22:19:24 +0000 (14:19 -0800)]
[flang] Fix type resolution in ConcurrentHeader

As it was implemented we weren't detecting non-constant kind parameters
in the integer-type-spec. The fix is just to walk the integer-type-spec
like was do any other one.

Also, there is not need for ResolveControlExpressions -- all it does is
walk that part of the parse tree.

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

4 years ago[flang] Move forall01 to ERROR_TESTS
Tim Keith [Mon, 23 Dec 2019 18:40:20 +0000 (10:40 -0800)]
[flang] Move forall01 to ERROR_TESTS

That seems to be what was intended and it provides for better checking
of errors.

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

4 years ago[flang] Merge pull request flang-compiler/f18#903 from flang-compiler/pmk-fix
Peter Klausler [Fri, 3 Jan 2020 19:33:12 +0000 (11:33 -0800)]
[flang] Merge pull request flang-compiler/f18#903 from flang-compiler/pmk-fix

Remove needless std::move() that breaks clang build

Original-commit: flang-compiler/f18@85f5cbecf16642b7be7416c1f6d83f85f8fbc9f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/903

4 years ago[flang] Remove needless std::move() that breaks clang build
peter klausler [Fri, 3 Jan 2020 18:30:14 +0000 (10:30 -0800)]
[flang] Remove needless std::move() that breaks clang build

Add the std::move() to where it should have been

Original-commit: flang-compiler/f18@54fe9b39a1551313da06e5c40ca2aa523288292d
Reviewed-on: https://github.com/flang-compiler/f18/pull/903

4 years ago[flang] Merge pull request flang-compiler/f18#902 from flang-compiler/ps-do-call
psteinfeld [Fri, 3 Jan 2020 17:09:02 +0000 (09:09 -0800)]
[flang] Merge pull request flang-compiler/f18#902 from flang-compiler/ps-do-call

Check for passing DO variables to OUT arguments in a CALL statement

Original-commit: flang-compiler/f18@27220661c3ac15c3135510b551458bc01a0a8ba5
Reviewed-on: https://github.com/flang-compiler/f18/pull/902

4 years ago[flang] Check for passing DO variables to OUT arguments in a CALL statement
Pete Steinfeld [Thu, 2 Jan 2020 20:26:47 +0000 (12:26 -0800)]
[flang] Check for passing DO variables to OUT arguments in a CALL statement

I added code to save the INTENT of a dummy argument in the checked expression
of the actual argument.  When processing a CallStmt, I then retrieve the
ProcedureRef, which contains a list of the checked ActualArguments.  I then
traverse this list looking for actual arguments that are active DO variable
that are being passed to dummy arguments whose INTENT is either OUT or INOUT.
For OUT dummies, I put out an error message and warn for INOUT dummies.

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

4 years ago[flang] Merge pull request flang-compiler/f18#901 from flang-compiler/pmk-operator-tbp
Peter Klausler [Thu, 2 Jan 2020 20:27:12 +0000 (12:27 -0800)]
[flang] Merge pull request flang-compiler/f18#901 from flang-compiler/pmk-operator-tbp

Fix type-bound user-defined operators

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