Commit graph

2869 commits

Author SHA1 Message Date
peter klausler 294cae1bcd [flang] Fix unrelated build error found in testing
Original-commit: flang-compiler/f18@5a00d77827
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-14 14:19:42 -08:00
peter klausler 26481ef2bb [flang] Update a test
Original-commit: flang-compiler/f18@5f32183eed
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-14 11:38:09 -08:00
peter klausler c1a710d772 [flang] Address review comments
Original-commit: flang-compiler/f18@d179c796bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-14 11:24:49 -08:00
peter klausler b07a4b2474 [flang] Better check for variables in DATA
Original-commit: flang-compiler/f18@92e20baaa8
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-14 11:11:15 -08:00
peter klausler 7010fff8de [flang] Fix bug
Original-commit: flang-compiler/f18@662b8139b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-13 15:39:18 -08:00
peter klausler c2bdc144c5 [flang] More comments addressed
Original-commit: flang-compiler/f18@9c863a572b
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-13 15:13:09 -08:00
peter klausler efa2ec7670 [flang] Address review comments
Original-commit: flang-compiler/f18@59e5565cb8
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-13 14:30:31 -08:00
peter klausler 15c89acb18 [flang] BLOCK DATA
add test

Original-commit: flang-compiler/f18@91c084b698
Reviewed-on: https://github.com/flang-compiler/f18/pull/926
Tree-same-pre-rewrite: false
2020-01-13 12:23:14 -08:00
Tim Keith b4eade7f88 [flang] Merge pull request flang-compiler/f18#928 from flang-compiler/tsk-assignment3
Pointer assignment semantic checks

Original-commit: flang-compiler/f18@fc600af81e
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
2020-01-14 13:09:08 -08:00
Tim Keith cb37808058 [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@3dc5fd6d9e
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
2020-01-14 13:02:56 -08:00
Tim Keith cfedf1dac9 [flang] C1027: procedure pointer may not be coindexed object
Original-commit: flang-compiler/f18@4261daf352
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
Tree-same-pre-rewrite: false
2020-01-14 13:02:56 -08:00
Tim Keith a5db74b614 [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@4cb1ee10b9
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
Tree-same-pre-rewrite: false
2020-01-14 13:02:56 -08:00
Tim Keith 355ab9bb82 [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@e16909d67f
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
Tree-same-pre-rewrite: false
2020-01-14 13:02:56 -08:00
Tim Keith c42a22091f [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@1658aba81f
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
Tree-same-pre-rewrite: false
2020-01-14 13:02:56 -08:00
Tim Keith ce3d838bc6 [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@e171029ccd
Reviewed-on: https://github.com/flang-compiler/f18/pull/928
Tree-same-pre-rewrite: false
2020-01-14 13:02:55 -08:00
Tim Keith 18e37a7adf [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@7cf6f6137d
Reviewed-on: https://github.com/flang-compiler/f18/pull/933
2020-01-14 13:06:06 -08:00
Tim Keith 889c81eae7 [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@c596d2fef7
Reviewed-on: https://github.com/flang-compiler/f18/pull/933
2020-01-14 12:06:52 -08:00
Peter Klausler 605d79eaeb [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@6adae0b7f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/932
2020-01-14 11:37:20 -08:00
peter klausler 1fe6297cab [flang] Fix bug flang-compiler/f18#931: spurious error reported on CSHIFT
Original-commit: flang-compiler/f18@bd9bd78865
Reviewed-on: https://github.com/flang-compiler/f18/pull/932
2020-01-14 10:53:36 -08:00
CarolineConcatto 0d9dd49ed4 [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@a58c6067a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/861
2020-01-14 08:20:49 -08:00
David Truby 05bdb54a49 [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@3ad75d123b
Reviewed-on: https://github.com/flang-compiler/f18/pull/916
2020-01-13 22:08:56 -08:00
psteinfeld d731aeffac [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@538a6dd5e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/924
2020-01-12 09:08:17 -08:00
Pete Steinfeld 5f7a9504ae [flang] Removed an unnecessary check after Tim fixed issue flang-compiler/f18#915.
Original-commit: flang-compiler/f18@348b04bc1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/924
2020-01-12 08:31:54 -08:00
psteinfeld 6e9673e91e [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@ab8fd34a71
Reviewed-on: https://github.com/flang-compiler/f18/pull/918
2020-01-10 15:43:33 -08:00
Pete Steinfeld ec45bc26d3 [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@815dbed75c
Reviewed-on: https://github.com/flang-compiler/f18/pull/918
2020-01-10 15:08:54 -08:00
Tim Keith 30088b77d9 [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@b29f284325
Reviewed-on: https://github.com/flang-compiler/f18/pull/923
2020-01-10 14:52:36 -08:00
Tim Keith 1243a0d175 [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@679ef69905
Reviewed-on: https://github.com/flang-compiler/f18/pull/923
2020-01-10 14:51:40 -08:00
Gary Klimowicz b37ba4d3e3 [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@9c7406324d
Reviewed-on: https://github.com/flang-compiler/f18/pull/922
2020-01-10 13:05:23 -08:00
Gary Klimowicz cea1040d51 [flang] Minor format change to LLVM license lines
Replace comment lines containing all dashes with the
proper ===-----....----=== markers.

Original-commit: flang-compiler/f18@a8936b0d41
Reviewed-on: https://github.com/flang-compiler/f18/pull/922
2020-01-10 12:12:03 -08:00
Peter Klausler fd2896e20a [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@5b7f08abd7
Reviewed-on: https://github.com/flang-compiler/f18/pull/919
2020-01-10 09:15:29 -08:00
peter klausler 9e6d1a7892 [flang] Dodge build problem in some Power environments
Original-commit: flang-compiler/f18@f24abf19c4
Reviewed-on: https://github.com/flang-compiler/f18/pull/919
2020-01-09 14:01:40 -08:00
Peter Klausler 1c21916785 [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@42ff2d0052
Reviewed-on: https://github.com/flang-compiler/f18/pull/914
2020-01-09 13:07:34 -08:00
peter klausler aeb07fbea6 [flang] Runtime starting and stopping
Define ImageTerminator as a mixin-able class

Turn start.cc into main.cc

Original-commit: flang-compiler/f18@cbc6225213
Reviewed-on: https://github.com/flang-compiler/f18/pull/914
2020-01-09 10:01:59 -08:00
Peter Klausler 9744328fed [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@66025c14e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/917
2020-01-09 12:28:39 -08:00
peter klausler e6ab4a7869 [flang] Address complaints in bug flang-compiler/f18#912
Original-commit: flang-compiler/f18@829f5647d6
Reviewed-on: https://github.com/flang-compiler/f18/pull/917
2020-01-09 09:39:09 -08:00
Peter Klausler 866ab07837 [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@2c6480a62d
Reviewed-on: https://github.com/flang-compiler/f18/pull/911
2020-01-08 09:04:30 -08:00
peter klausler d267f20a07 [flang] Fold TRIM
Accept IS_CONTIGUOUS and fold it

test folding is_contiguous

Original-commit: flang-compiler/f18@c75a0791b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/911
2020-01-08 08:44:30 -08:00
Peter Klausler 7ae9cf9535 [flang] Merge pull request flang-compiler/f18#910 from flang-compiler/pmk-fold-more
Fold more intrinsic functions

Original-commit: flang-compiler/f18@4f737d4cf6
Reviewed-on: https://github.com/flang-compiler/f18/pull/910
2020-01-07 13:08:51 -08:00
peter klausler 91a2f0c75c [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@36769996fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/910
2020-01-07 13:06:08 -08:00
Peter Klausler e546a20972 [flang] Merge pull request flang-compiler/f18#907 from flang-compiler/pmk-enable-semantics
Enable semantic analysis by default

Original-commit: flang-compiler/f18@26ab874511
Reviewed-on: https://github.com/flang-compiler/f18/pull/907
2020-01-07 11:42:20 -08:00
peter klausler 01c3e4c9f0 [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@57058a5b16
Reviewed-on: https://github.com/flang-compiler/f18/pull/907
2020-01-07 10:24:33 -08:00
Peter Klausler 6099a1b17f [flang] Merge pull request flang-compiler/f18#897 from kiranchandramohan/critical-3
Semantic Checks for critical construct

Original-commit: flang-compiler/f18@b17ab7f7bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/897
2020-01-04 07:55:26 -08:00
Kiran Chandramohan 582b932542 [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@4b7a007ff3
Reviewed-on: https://github.com/flang-compiler/f18/pull/897
2020-01-04 15:13:28 +00:00
Peter Klausler c3192a17ed [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@ccb3ae517b
Reviewed-on: https://github.com/flang-compiler/f18/pull/905
2020-01-03 16:22:18 -08:00
peter klausler cc179ba749 [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@f663d4fef4
Reviewed-on: https://github.com/flang-compiler/f18/pull/905
2020-01-03 16:12:06 -08:00
Peter Klausler 8697c77bac [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@a4540324a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/906
2020-01-03 15:22:15 -08:00
peter klausler 39114d503a [flang] Another attempt to fix bug flang-compiler/f18#877
Original-commit: flang-compiler/f18@2ad2330cda
Reviewed-on: https://github.com/flang-compiler/f18/pull/906
2020-01-03 15:08:37 -08:00
Tim Keith 0922083181 [flang] Merge pull request flang-compiler/f18#904 from flang-compiler/tsk-assignment3
Add analyzed form of pointer assignment

Original-commit: flang-compiler/f18@1f6cc18c7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
2020-01-03 14:11:14 -08:00
Tim Keith d42aaa81f2 [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@140c983423
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
2020-01-03 14:10:26 -08:00
Tim Keith b58617b940 [flang] Use common SymbolSet type
Replace `std::set<const Symbol *>` with `SymbolSet` from `symbol.h`.

Original-commit: flang-compiler/f18@78e3ff33cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
Tree-same-pre-rewrite: false
2020-01-03 14:09:47 -08:00