Commit Graph

1669 Commits

Author SHA1 Message Date
peter klausler c4f0ea5a14 [flang] Pass PGF90 options on only if underlying compiler is PGF90
Original-commit: flang-compiler/f18@dc34f75b07
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:40 -07:00
peter klausler 33c397308c [flang] Remove unused PRIVATE name
Original-commit: flang-compiler/f18@829b8ca873
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:39 -07:00
peter klausler a0e5052d1b [flang] Add DOUBLE COMPLEX intrinsics & ASSOCIATED
Original-commit: flang-compiler/f18@fbcc2c0b5d
Reviewed-on: https://github.com/flang-compiler/f18/pull/531
Tree-same-pre-rewrite: false
2019-06-28 09:16:38 -07:00
Peter Steinfeld ff2c862e07 [flang] Fixed the formatting of an "if" statement.
Original-commit: flang-compiler/f18@0cf7114452
Reviewed-on: https://github.com/flang-compiler/f18/pull/533
2019-06-27 15:18:36 -07:00
Peter Steinfeld aafeb34962 [flang] Fixes for DO constraint C1124
The constraint says that a variable-name in a locality-spec shall be the name
of a variable in the innermost executable construct or scoping unit that
includes the DO CONCURRENT statement.  This check was already being made in
resolve-names.cc for LOCAL and LOCAL_INIT locality specs but not for the
SHARED locality spec.  Also, there was some code in check-do.cc that was
intended to be used to enforce this constraint at some time in the future.

I added code to resolve-names.cc to extend the checking to the SHARED locality
spec and removed the unused code from check-do.cc.  I also extended the
existing tests in resolve35.f90 to exercise the new code.

Original-commit: flang-compiler/f18@b421923d94
Reviewed-on: https://github.com/flang-compiler/f18/pull/533
Tree-same-pre-rewrite: false
2019-06-27 12:33:36 -07:00
Peter Waller c9944df916 [flang] Revert "Remove needless braces"
This reverts commit edd18355be574122aaa9abf58c15d8c50fb085a1.

Original-commit: flang-compiler/f18@e5d164fd11
Reviewed-on: https://github.com/flang-compiler/f18/pull/532
2019-06-26 09:44:08 +00:00
vdonaldson 6b688f9473 [flang] Remove unnecessary semicolons to avoid gcc warnings. (flang-compiler/f18#529)
Original-commit: flang-compiler/f18@bdba836254
Reviewed-on: https://github.com/flang-compiler/f18/pull/529
2019-06-26 15:50:10 -07:00
vdonaldson 3b14129337 [flang] Initialize PRINT semantics. Fixes flang-compiler/f18#516 (flang-compiler/f18#528)
There are no Clause 12 constraints to check for PRINT, but PRINT does share
FMT specifier processing with READ and WRITE.  To avoid interactions between
these I/O statements, reset IoChecker values for PRINT.

Original-commit: flang-compiler/f18@6a54766718
Reviewed-on: https://github.com/flang-compiler/f18/pull/528
2019-06-26 15:46:48 -07:00
Steve Scalpone 93c63ed8c2 [flang] Compile and install the predefined module files.
Change the CMakeFile.txt in tools/f18 to build the predefined modules with the just-built compiler. The mod files are created in the new "include" subdirectory of the binary target directory.  The mod files are installed to ${CMAKE_INSTALL_PREFIX}/include.

The f18 driver is already installed in ${CMAKE_INSTALL_PREFIX}/bin.  This change change the location of the f18 binary build to a sibling directory of "include" called "bin" instead of at the top level of the binary destination directory. This change is in anticipation of changing the driver to find the include directory using a path relative to the location of f18.

Update the test scripts to find f18 in the bin subdirectory.

Remove the simple predefined module tests from test/semantics because they are compiled as part of the build and don't need to be recompiled as part of a test.

Original-commit: flang-compiler/f18@7811ccecdc
Reviewed-on: https://github.com/flang-compiler/f18/pull/526
2019-06-25 09:57:38 -07:00
Jinxin (Brian) Yang 125f295353 [flang] OpenMP structural check framework (PARALLEL as example) (flang-compiler/f18#493)
This patch is to show the framework to do OpenMP structure related check and you may find missing/incomplete implementation, which will be added in the future.

1. Each encountering construct has its own context and the context info will be filled while walking the directive/clause nodes. In the `Leave`, the current OpenMP context will be popped out.

2. When entering the construct, necessary nesting check will be performed. Use std::vector to implement the context stack because certain nesting restrictions may need to trace back more than one level.

3. PARALLEL construct is used as an example for clause validity check.

4. `EnumSet` is used to represent the directive/clause sets and to show the error msg. All the error msgs are quoted from the specification.

5. Necessary `CharBlock` is added for error msgs.

Original-commit: flang-compiler/f18@620441c03e
Reviewed-on: https://github.com/flang-compiler/f18/pull/493
2019-06-25 16:18:51 -07:00
vdonaldson 69f5f13738 [flang] Clause 13 (Input/output editing) syntax and semantic checking (flang-compiler/f18#498)
* Clause 13 (Input/output editing) syntax and semantic checking

Diagnose:
 - all clause syntax errors (independent of normal parsing)
 - all clause constraints
 - use of non-standard extensions under -Mstandard
 - obvious program requirement violations

The code:
 - is invoked for both format statement and I/O statement constant formats
 - should be useable by the runtime I/O library for runtime formats
 - is able to recover from errors
 - is able to diagnose multiple errors in a single format
 - has accurate markers for errors
 - can process (fixed character size) Hollerith strings
 - generates reasonable error messages for known error scenarios
 - should not require C++ run-time library support

The code is templatized for use with fixed size character kind={1,2,4} input,
but only the kind=1 variant is actually exercised.

* Review update.

* Review update.

* Review update.

* Improve error processing of unterminated formats.

Original-commit: flang-compiler/f18@c04b7518df
Reviewed-on: https://github.com/flang-compiler/f18/pull/498
2019-06-25 15:59:30 -07:00
Tim Keith fe899298d0 [flang] Check constraints on passed-object dummy argument
The passed-object dummy argument cannot be checked until the
interfaces of contained subprograms are known. To accomplish this,
add `FinishSpecificationPart` pass to run after all specification
parts have been analyzed but before any of the execution parts.
This visits all derived types defined in each scope and performs
the checks on each procedure component and procedure binding.

Add a flag to `ParamValue` to distinguish kind from len parameters.

Fix some tests that had errors we now detect.

Original-commit: flang-compiler/f18@4789643c5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/521
2019-06-23 10:59:32 -07:00
Tim Keith 432e62b417 [flang] Add passArg to ProcEntityDetails and ProcBindingDetails
Add `passArg` to `ProcEntityDetails` and `ProcBindingDetails`.
The is the symbols that represents the passed-object dummy argument,
or nullptr if none.

As both of these classes need `passName` and `passArg`, create a mixin
class, `WithPassArg` for the shared content.

Change passName_ from optional to pointer because that makes it a little
easier to work with and there is no need to have a copy of the name.

Original-commit: flang-compiler/f18@1cdd1a5b87
Reviewed-on: https://github.com/flang-compiler/f18/pull/521
Tree-same-pre-rewrite: false
2019-06-22 18:53:16 -07:00
Tim Keith 9a98616dbb [flang] Add AsFortran() for types
Add an `AsFortran()` member function to `DeclTypeSpec` and related
classes to convert types to a Fortran representation. This allows
error messages to mention types. It also fixes `.mod` file writing
where it previous used `operator<<` to convert types to Fortran.

Original-commit: flang-compiler/f18@eb16f8b5dd
Reviewed-on: https://github.com/flang-compiler/f18/pull/521
Tree-same-pre-rewrite: false
2019-06-22 18:14:14 -07:00
Tim Keith 377914d8b3 [flang] Add IsIsoCType()
It identifies the types `C_PTR` and `C_FUNPTR` from predefined
module `ISO_C_BINDING`.

Original-commit: flang-compiler/f18@fcbef2e18b
Reviewed-on: https://github.com/flang-compiler/f18/pull/521
Tree-same-pre-rewrite: false
2019-06-21 17:32:11 -07:00
Peter Steinfeld 21d1e7131d [flang] Downgrading the semantics check for C1127 to a warning.
This check to see if there are two DEFAULT (NONE) clauses in a DO CONCURRENT
header.

Original-commit: flang-compiler/f18@9b234125fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/513
2019-06-24 13:09:21 -07:00
Peter Steinfeld db1ba910c5 [flang] Test for constraint C1127
The DEFAULT ( NONE ) locality-spec shall not appear more than once in a given
concurrent-locality.

Original-commit: flang-compiler/f18@fcca28ef3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/513
Tree-same-pre-rewrite: false
2019-06-24 13:09:21 -07:00
Tim Keith facd7147f4 [flang] Fix internal error due to missing type
If a name is declared in a module with just `private :: x`,
we don't know if `x` is supposed to be an object or procedure,
so it ends up not getting an implicit type. This leads to an
internal error when writing the `.mod` file.

The fix requires two changes:
1. Cause all `EntityDetails` to be converted to `ObjectEntityDetails`
   in `ResolveSpecificationParts`. This is done by calling `PopScope()`.
   The reason for not calling it there no longer applies since the
   addition of the `ExecutionPartSkimmer` pass.
2. In the same place, apply the implicit typing rules to every entity
   in the scope.

Fixes flang-compiler/f18#514, fixes flang-compiler/f18#520.

Original-commit: flang-compiler/f18@7e4185e9ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/524
2019-06-24 15:22:57 -07:00
Eric Schweitz 1a66379de4 [flang] address review comments
add words on what is meant by meta information

Original-commit: flang-compiler/f18@ee2f3acf3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/507
2019-06-20 10:58:08 -07:00
Eric Schweitz 20984efc71 [flang] Add the FIR dialect of MLIR document
Original-commit: flang-compiler/f18@10ab8b42b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/507
Tree-same-pre-rewrite: false
2019-06-19 14:11:32 -07:00
Tim Keith 86132a15dc [flang] Fix bug in writing PRIVATE subprograms to .mod file
Subprograms can't have the PRIVATE prefix on them when they are defined.
So if they are private, add a private-stmt for them.

Fixes flang-compiler/f18#519

Original-commit: flang-compiler/f18@d3670aa176
Reviewed-on: https://github.com/flang-compiler/f18/pull/523
2019-06-24 12:35:17 -07:00
Steve Scalpone e73c886bdf [flang] Port to macOS, where mktemp doesn't have -p.
Original-commit: flang-compiler/f18@bd698aee68
Reviewed-on: https://github.com/flang-compiler/f18/pull/522
2019-06-23 17:14:19 -07:00
Steve Scalpone 10ad02ff2d [flang] Add a set of tests which compile the predefined module files. Each test simply tries to compile the module source file. Modify the script test_errors.sh to work with a source file that is specified as a full path. Also, change how the test temp directory is created to use a random name in case any of the source file base names are duplicated.
Original-commit: flang-compiler/f18@ec048ab1d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/522
Tree-same-pre-rewrite: false
2019-06-23 13:30:23 -07:00
Peter Steinfeld 6e12d0810a [flang] Changes to improve messages for DO semantics
I changed two things in the messages produced for DO semantic checks --
 - I changed the source location to be specific to where conflicting names are
 declared.
 - I added the conflicting names to the message.

Original-commit: flang-compiler/f18@f39f9ceeae
Reviewed-on: https://github.com/flang-compiler/f18/pull/510
2019-06-20 17:07:13 -07:00
Tim Keith 56b0e2a759 [flang] Fix CHECK failure on undeclared type parameter
In the example below, the compiler gets an internal error when
processing the derived-type-spec for the declaration of `x`.
When the search for type parameter `k` fails it means an error
has already occurred and we should skip that parameter.

```
type :: t(k)
end type
type(t):: x
end
```

Original-commit: flang-compiler/f18@a4bf1922e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/509
2019-06-20 14:23:21 -07:00
Peter Steinfeld a26fff722f [flang] Added "const" to a few declarations in response to review comments.
Original-commit: flang-compiler/f18@f93045c523
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
2019-06-20 11:45:17 -07:00
Peter Steinfeld fe19b37dea [flang] These changes are in response to comments on my pull request for C1123.
Here's a summary of the changes:
 - I renamed a function to ResolveControlExpressions for clarity.
 - I changed the interface to the function to ResolveIndexName for clarity.
 - I simplified the code for walking the "step" and scalar mask expressions in
   a DO CONCURRENT control statements to not check for the presence of optional
   expressions.
 - I added "const" to the declaration of a local variable.
 - I removed some spurious comments from the test dosemantics04.f90.
 - I added two new tests to dosemantics04.f90 to verify cases that were not
   covered in my original test implementation.

Original-commit: flang-compiler/f18@fa5827061a
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
Tree-same-pre-rewrite: false
2019-06-20 09:58:03 -07:00
Peter Steinfeld 88054b3491 [flang] I fixed a problem in C1123. This constraint requires that expressions in a DO
CONCURRENT header not reference names declared in the same header.  To
implement this, I changed the "Pre" function for ConcurrentHeader to walk the
subtree in an order that caused the variables associated with the declared
names to be created before any of the expressions were walked.

I added the test dosemantics04.f90 to test this.

Original-commit: flang-compiler/f18@9f3b552414
Reviewed-on: https://github.com/flang-compiler/f18/pull/504
Tree-same-pre-rewrite: false
2019-06-20 09:58:03 -07:00
peter klausler daef068a0b [flang] back out -Mstandard
Original-commit: flang-compiler/f18@a040c4bdef
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
2019-06-19 16:44:36 -07:00
peter klausler 9a9b450011 [flang] EQUIVALENCE numeric/character as extension with warning
Original-commit: flang-compiler/f18@0182efb759
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
Tree-same-pre-rewrite: false
2019-06-19 16:34:50 -07:00
peter klausler 40b1cc9b62 [flang] Fix a couple bugs with SELECT TYPE(p) from regression tests
Original-commit: flang-compiler/f18@7539a01ecd
Reviewed-on: https://github.com/flang-compiler/f18/pull/508
Tree-same-pre-rewrite: false
2019-06-19 16:34:50 -07:00
Tim Keith e9920a6861 [flang] Prevent .mod files from being left by tests
test_symbols.sh and test_folding.sh were running the compiler in the
test directory (e.g. `<build>/test/semantics`). This meant that .mod
files were being left there because they weren't cleaned up.

Change to run the compiler in the temp directory created for each test.
It is deleted at the end so files aren't left behind.

Original-commit: flang-compiler/f18@4f9735ada7
Reviewed-on: https://github.com/flang-compiler/f18/pull/506
2019-06-19 13:18:17 -07:00
peter klausler cedf98c165 [flang] Remove extra semicolon
Original-commit: flang-compiler/f18@c94327b56b
Reviewed-on: https://github.com/flang-compiler/f18/pull/505
2019-06-19 12:37:49 -07:00
peter klausler 4f2c8fae65 [flang] Fix source provenance of .NOT., add ALLOCATED intrinsic
Original-commit: flang-compiler/f18@e7e0de9e0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/505
Tree-same-pre-rewrite: false
2019-06-19 11:50:07 -07:00
peter klausler b6a1fdf5e0 [flang] Force -fexceptions for real arithmetic tests
Original-commit: flang-compiler/f18@532dd3b6df
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
2019-06-18 15:32:20 -07:00
peter klausler 7d24cebc17 [flang] Rearrange some move(get<>()) calls into get<>(move()) to dodge GCC possibly-uninit warnings (bogus)
Original-commit: flang-compiler/f18@f369c6025c
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
Tree-same-pre-rewrite: false
2019-06-18 15:15:22 -07:00
peter klausler b3c7a79e2d [flang] -fno-exceptions
Original-commit: flang-compiler/f18@81d09c2053
Reviewed-on: https://github.com/flang-compiler/f18/pull/503
Tree-same-pre-rewrite: false
2019-06-18 14:11:55 -07:00
peter klausler f753cf3eb0 [flang] Review comments and last (?) bugs
Original-commit: flang-compiler/f18@db8302e3ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
2019-06-18 13:46:54 -07:00
peter klausler fdcdd504b3 [flang] more fixes from tests
Original-commit: flang-compiler/f18@bb8df72635
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-18 12:34:23 -07:00
peter klausler 94a667bb94 [flang] nag debugged
Original-commit: flang-compiler/f18@ab91b7c191
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:10 -07:00
peter klausler fd54622481 [flang] fixes
Original-commit: flang-compiler/f18@f504e6a938
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:10 -07:00
peter klausler 7c4b790c5e [flang] All fixed except for a few NAG differences
Original-commit: flang-compiler/f18@8dea4fb760
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:09 -07:00
peter klausler 8971f7f2b3 [flang] More debugging vs. regression tests
Original-commit: flang-compiler/f18@d4fd4ad1ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:08 -07:00
peter klausler 6911444f76 [flang] Fixes
Original-commit: flang-compiler/f18@73edc5bf2b
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:08 -07:00
peter klausler 15af2b2f06 [flang] Character set and encoding changes
Original-commit: flang-compiler/f18@a550cbd4c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:07 -07:00
peter klausler e7a21f763a [flang] Tests pass
Original-commit: flang-compiler/f18@ae9d07a2ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/496
Tree-same-pre-rewrite: false
2019-06-17 16:13:07 -07:00
Tim Keith 7d464b02c6 [flang] Handle nested interface blocks
Interface blocks can be nested if one of the interface bodies
declares a subprogram with a dummy procedure that is specified
by an interface block. See the addition to `modfile07.f90` for
and example.

This didn't work because there was only one copy of each of
`inInterfaceBlock_`, `isAbstract_`, and `genericSymbol_`.
We need these for each active interface block, so replace these
with a stack. A new entry is pushed on the stack when we enter
an `InterfaceStmt` or `GenericStmt` and popped when we leave.

Also in the same example, when declaring the dummy procedure, the
dummy argument is initially an `EntityDetails` but it is replaced
by a `SubprogramDetails` when it is specified by the interface.

Original-commit: flang-compiler/f18@0c468b60b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/502
2019-06-14 15:04:13 -07:00
Jinxin Yang 1e33dfb431 [flang] Add missing IS_DEVICE_PTR and LINK clauses for OpenMP parsing
Original-commit: flang-compiler/f18@541d4031e0
Reviewed-on: https://github.com/flang-compiler/f18/pull/501
2019-06-13 15:33:15 -07:00
Steve Scalpone 057fb5c2d0 [flang] Remove extra spaces.
Original-commit: flang-compiler/f18@777bf033b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
2019-06-12 21:01:26 -07:00
Steve Scalpone 43b6209ed9 [flang] Our coding conventions prohibit rtti; enforce with the -fno-rtti compilation flag.
Original-commit: flang-compiler/f18@d2817cc9c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/497
Tree-same-pre-rewrite: false
2019-06-12 17:01:41 -07:00
Tim Keith 9d125624f6 [flang] Handle substring of array element in EQUIVALENCE
A substring of an array element is legal as an equivalence object,
e.g. `a(2,3)[4:5]`. Extend `EquivalenceObject` to include the start
of the substring, if any. Split `CheckBound` into `CheckArrayBound`
and `CheckSubstringBound`.

When evaluating bounds in `AddToSet` we can assert they are constant
because all of the error cases should have been detected already.

Original-commit: flang-compiler/f18@0b4050b2d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/494
2019-06-12 12:38:04 -07:00
Tim Keith 9ef62dbb6a [flang] Resolve and check names in equivalence sets
Collect sets of `parser::EquivalenceObject` to process at the end of
the specification part. This is so that names mentioned in the
EQUIVALENCE statement don't trigger implicit declarations.

The `EquivalenceSets` class performs most of the numerous checks
on objects that can be in equivalence sets at all and objects that
can be in them together. It also merges sets when the same object
appears in more than one.

Once equivalence sets are checked they are added to the `Scope`.
Further checks will be necessary after the size and alignment of
variables are computed.

Add `FindUltimateComponent` to simplify checks on ultimate components
of derived types. Use it to implement `HasCoarrayUltimateComponent`
and checks on equivalence objects.

Make `ExpressionAnalyzer::Analyze(Designator)` public so that
`parser::EquivalenceObject` can be analyzed.

Add `GetDefaultKind`, `doublePrecisionKind`, and `quadPrecisionKind`
to `SemanticsContext` so that `defaultKinds_` does not need to be
accessed directly.

Original-commit: flang-compiler/f18@1cc898e5b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/494
Tree-same-pre-rewrite: false
2019-06-11 18:26:48 -07:00
peter klausler fa205d1424 [flang] Improve clarity per review comment
Original-commit: flang-compiler/f18@7206c08f2a
Reviewed-on: https://github.com/flang-compiler/f18/pull/492
2019-06-11 12:50:27 -07:00
peter klausler a306d92675 [flang] Fix bug flang-compiler/f18#491 (and replace a misleading name)
Original-commit: flang-compiler/f18@d0d154e312
Reviewed-on: https://github.com/flang-compiler/f18/pull/492
Tree-same-pre-rewrite: false
2019-06-11 12:06:18 -07:00
Peter Steinfeld 609e2d753b [flang] Fixed situations where multiple error messages were being emitted.
Original-commit: flang-compiler/f18@ac62cfa9cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
2019-06-10 15:10:32 -07:00
Peter Steinfeld c97f17a59f [flang] Renamed check.*do.*stmt to check.*do to better conform with the grammar.
Original-commit: flang-compiler/f18@d7419566e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 14:03:24 -07:00
Peter Steinfeld 169b8272e8 [flang] These are additional changes for issue 458, to perform semantic checks on DO
variable and initial, final, and step expressions.

Here's a summary of the changes since my original pull request:

 - I've taken into account the possibility that the DO variable is declared in
   a MODULE.  This required a call to GetUltimate() on the Symbol for the DO
   variable.
 - The previous change exposed problems in the semantic checking for NULLIFY
   and DEALLOCATE statements, so I've included fixes and tests for those.  I
   also added a test for the ALLOCATE statement, even though it was already
   handling this case.
 - I now handle the case where a procedure name is erroneously used as a DO variable.
 - I now handle the case where a pointer to a procedure is erroneously used as
   a DO variable.
 - I now check that the DO expressions are not null.
 - I added tests for all cases listed above.

Original-commit: flang-compiler/f18@219d856fdb
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
Peter Steinfeld 3ab209b58e [flang] Changes in response to Peter's comments on a previous pull request.
Specifically, that the conversion of warnings to errors will happen in a
single place in the compiler once we implement warnings as distinct from
errors.  This change made on of the tests invalid.

Also, there's no need to check whether the extension to allow
REAL DO controls is enabled.

Original-commit: flang-compiler/f18@2fae9edd77
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
Peter Steinfeld 0bef67225a [flang] Added the machinery for REAL DO controls to be treated as a separate
extension.

Original-commit: flang-compiler/f18@1907cf8672
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
Peter Steinfeld a698d3d579 [flang] Changes responding to comments on my previous pull request. Specifically --
parse-tree.cc
 - Cleaned up the use of "const" in several declarations.
check-do-stmt.cc
 - Replaced uses of parser::Messages with SemanticsContext.
 - Removed unused "==" operator from the DoStmtContext class.
 - Reduced the size of the GetBounds function by calling GetLoopControl().
 - Changed the warning message for REAL DO controls to not mention standard
   extensions.
check-do-stmt.h
 - Restored the forward reference to Fortran::parser::DoConstruct and removed
   the include of parse-tree.h
dosemantics*.f90
 - Removed extraneous references to the "RUN" command.
test_errors.sh
 - Simplified and generalized the extraction of the OPTIONS specification.

Original-commit: flang-compiler/f18@04a0712766
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
Peter Steinfeld 93a59505a5 [flang] These changes are for issue 458, to perform semantic checks on DO variable
and initial, final, and step expressions.  As a new extension, we want to allow
REAL and DOUBLE PRECISION values for them by default.

Here's a summary of the changes:
 - There already existed infrastructure for semantic checking of DO loops that
   was partially specific to DO CONCURRENT loops.  Because I re-used some of
   this infrastructure, I renamed some files and classes from "concurrent" to
   "stmt".
 - I added some functions to distinguish among the different kinds of DO
   statements.
 - I added the functions to check-do-stmt.cc to produce the necessary warnins
   and errors.  Note that there are no tests for the warnings since the
   necessary testing infrastructure does not yet exist.
 - I changed test-errors.sh so that additional compilation options can be
   specified in the test source.
 - I added two new tests to test for the various kinds of values that can be
   used for the DO variables and control expressions.  The two tests are
   identical except for the use of different compilation options.
   dosemantics03.f90 specifies the options "-Mstandard -Werror" to produce
   error messages for the use of REAL and DOUBLE PRECISION DO variables and
   controls.  dosemantics04.f90 uses the default options and only produces
   error messages for contructs that are erroneous by default.

Original-commit: flang-compiler/f18@f484660c75
Reviewed-on: https://github.com/flang-compiler/f18/pull/478
Tree-same-pre-rewrite: false
2019-06-10 13:31:31 -07:00
peter klausler 754c88f35f [flang] Remove temporary debugging code
Original-commit: flang-compiler/f18@e7147ebfbe
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
2019-06-10 09:26:02 -07:00
peter klausler 812bda43f1 [flang] Dodge valgrind complaint by cleaning up the grammar a bit
Original-commit: flang-compiler/f18@3f9f9af1e8
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
2019-06-07 16:01:21 -07:00
peter klausler 82f119414c [flang] some clean-up
Original-commit: flang-compiler/f18@6134e1c2f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
2019-06-07 16:01:20 -07:00
peter klausler 7269dc8a82 [flang] Remove needless braces
Original-commit: flang-compiler/f18@edd18355be
Reviewed-on: https://github.com/flang-compiler/f18/pull/490
Tree-same-pre-rewrite: false
2019-06-07 16:01:20 -07:00
Eric Schweitz 5c978b94a2 [flang] remove FIR
Original-commit: flang-compiler/f18@008ad16e28
Reviewed-on: https://github.com/flang-compiler/f18/pull/489
2019-06-07 10:20:15 -07:00
Eric Schweitz 6bbcc8c1d8 [flang] Remove the old FIR middle end from the f18 program and speed up build time.
Original-commit: flang-compiler/f18@5b410b978c
Reviewed-on: https://github.com/flang-compiler/f18/pull/489
Tree-same-pre-rewrite: false
2019-06-07 10:19:59 -07:00
Eric Schweitz 8242853380 [flang] start splitting up afforestation so it isn't monolithic
Original-commit: flang-compiler/f18@842a42d954
Reviewed-on: https://github.com/flang-compiler/f18/pull/489
Tree-same-pre-rewrite: false
2019-06-07 10:19:45 -07:00
peter klausler 3e92bb77aa [flang] Address review comment
Original-commit: flang-compiler/f18@d6964fdd9f
Reviewed-on: https://github.com/flang-compiler/f18/pull/488
2019-06-07 12:00:32 -07:00
peter klausler fc61632c21 [flang] Fix characterization of functions called in association selectors
Original-commit: flang-compiler/f18@cada0c61e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/488
Tree-same-pre-rewrite: false
2019-06-07 10:24:35 -07:00
peter klausler b408a02c14 [flang] Avoid segfault in association semantics by cleaning up code a bit
Original-commit: flang-compiler/f18@04d40c3d75
Reviewed-on: https://github.com/flang-compiler/f18/pull/488
Tree-same-pre-rewrite: false
2019-06-07 10:24:33 -07:00
peter klausler 8a326cb7f7 [flang] Interpret intrinsic table more correctly
Original-commit: flang-compiler/f18@ff34f32447
Reviewed-on: https://github.com/flang-compiler/f18/pull/488
Tree-same-pre-rewrite: false
2019-06-07 10:24:33 -07:00
peter klausler a28607f837 [flang] Use ConstantSubscript as the one name for int64_t
Original-commit: flang-compiler/f18@13870c0017
Reviewed-on: https://github.com/flang-compiler/f18/pull/484
2019-06-07 09:57:52 -07:00
peter klausler c26b696085 [flang] Clean up subscript-sized int definitions
Original-commit: flang-compiler/f18@256fc4e3ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/484
Tree-same-pre-rewrite: false
2019-06-07 09:57:49 -07:00
Tim Keith e69c6a6259 [flang] Fix issue flang-compiler/f18#486
In a function without a function result specified, the name in the
`FunctionStmt` was resolved to the function result symbol rather than
the function symbol itself. That is inconsistent with subroutines and
other functions.

The fix is to explicitly set the function name symbol after the result
has been resolved.

Original-commit: flang-compiler/f18@b0172d3284
Reviewed-on: https://github.com/flang-compiler/f18/pull/487
2019-06-06 16:09:11 -07:00
Jean Perier 5567377d36 [flang] Remove unused captured values
Original-commit: flang-compiler/f18@ae79e7e699
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
2019-06-06 01:34:39 -07:00
Jean Perier 5b569e209a [flang] Fix logical conflict after rebase
Original-commit: flang-compiler/f18@93d6c1e53a
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 07:33:37 -07:00
Jean Perier 6dd3ca917a [flang] Remove encoding related checks in achar/char
Original-commit: flang-compiler/f18@86bc6a0252
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:54:01 -07:00
Jean Perier 6a1b208a4d [flang] Answer first comments
Original-commit: flang-compiler/f18@4058efcd9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:53:57 -07:00
Jean Perier e303c352ce [flang] Implement folding of IACHAR, ICHAR, CHAR, ACHAR, ADJUSTL, ADJUSTR
Original-commit: flang-compiler/f18@e8e8071e93
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:53:49 -07:00
Jean Perier bc30bef24b [flang] Fix UTF-8 bugs and add related tests
Original-commit: flang-compiler/f18@9dd19ede9e
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:53:23 -07:00
Jean Perier 958e4e691e [flang] checkpoint character intrinsic folding
Original-commit: flang-compiler/f18@f495ed92bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/471
Tree-same-pre-rewrite: false
2019-06-05 06:43:38 -07:00
Jean Perier 8dbb09119b [flang] Address formatting comment
Original-commit: flang-compiler/f18@0f5fb6e75a
Reviewed-on: https://github.com/flang-compiler/f18/pull/483
2019-06-06 07:41:57 -07:00
Jean Perier 493cee5ca8 [flang] Remove OS dependency in folding test
Original-commit: flang-compiler/f18@3728898ea9
Reviewed-on: https://github.com/flang-compiler/f18/pull/483
Tree-same-pre-rewrite: false
2019-06-06 04:24:42 -07:00
Jean Perier 057b6875f7 [flang] Fix 482: do not check floating point environment flags with clang
Original-commit: flang-compiler/f18@fc423c1516
Reviewed-on: https://github.com/flang-compiler/f18/pull/483
Tree-same-pre-rewrite: false
2019-06-06 03:24:35 -07:00
peter klausler 0f1fd64ae5 [flang] Other changes moved to their own branch.
Original-commit: flang-compiler/f18@6a922d085a
Reviewed-on: https://github.com/flang-compiler/f18/pull/485
2019-06-06 13:56:22 -07:00
peter klausler d8f72a3105 [flang] Placeholder for standard module iso_fortran_env
Original-commit: flang-compiler/f18@386ebb0490
Reviewed-on: https://github.com/flang-compiler/f18/pull/485
Tree-same-pre-rewrite: false
2019-06-06 13:42:33 -07:00
peter klausler 4d7da503fc [flang] Apply suggestion from code review
Original-commit: flang-compiler/f18@211c99917c
Reviewed-on: https://github.com/flang-compiler/f18/pull/480
2019-06-05 09:12:21 -07:00
peter klausler dd50c1bca7 [flang] Fix two bugs
Original-commit: flang-compiler/f18@919e512c08
Reviewed-on: https://github.com/flang-compiler/f18/pull/480
Tree-same-pre-rewrite: false
2019-06-04 17:03:34 -07:00
peter klausler f586ad5e56 [flang] Unparse the typedExpr from semantics, when present, rather than original parse tree expressions
Original-commit: flang-compiler/f18@4274cc8eaa
Reviewed-on: https://github.com/flang-compiler/f18/pull/479
2019-06-04 16:25:06 -07:00
peter klausler 2e44404e94 [flang] Fix build warning, add comment about extension not supported
Original-commit: flang-compiler/f18@1033ae05ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
2019-06-04 14:51:56 -07:00
peter klausler cab9b3072b [flang] Skim executable parts to detect dummy procedure calls
Original-commit: flang-compiler/f18@b085255e5c
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:35 -07:00
peter klausler 0d242e2006 [flang] INTRINSIC attribute should convert symbol to procedure; also check C840
Original-commit: flang-compiler/f18@b698b84ccd
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:26 -07:00
peter klausler 5774f0ab30 [flang] Fix arg specs for CMPLX intrinsic
Original-commit: flang-compiler/f18@3586b8a646
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:25 -07:00
peter klausler fb1fcbb9cd [flang] Fix LEN(char array), it is not elemental.
Original-commit: flang-compiler/f18@b44eb2e7b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:23 -07:00
peter klausler b50170c99d [flang] allow alternate return indicators
Original-commit: flang-compiler/f18@a04150a4f9
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:20 -07:00
peter klausler 89a0181da6 [flang] Allow for FINAL procedures in PDT instantiation
Original-commit: flang-compiler/f18@e276374b29
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:17 -07:00
peter klausler 3e313d43e1 [flang] Fix correction of misparsed struct const as actual arg, and semantics of MODULE PROCEDURE in INTERFACE
Original-commit: flang-compiler/f18@6c86de6cef
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:16 -07:00
peter klausler d72fd348f7 [flang] Allow some BOZ usage when unambiguous (extension)
Original-commit: flang-compiler/f18@bf3bd54c88
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:12 -07:00
peter klausler 0ddea8ae24 [flang] Rearrange references to AllSources singleton, fix FindScope for module files
Original-commit: flang-compiler/f18@50ccc1c819
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:09 -07:00
peter klausler 9d5490a561 [flang] Fix spelling of ISHFT
Original-commit: flang-compiler/f18@3c93c40ed5
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:08 -07:00
peter klausler 184d801fc4 [flang] Placeholders for some standard modules
Original-commit: flang-compiler/f18@a7182af0d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/477
Tree-same-pre-rewrite: false
2019-06-04 13:37:07 -07:00
Tim Keith 473658dd86 [flang] Fix test_folding.sh to work on MacOS
There were a couple of small incompatibilities:
- There is no `ldd` on MacOS; instead use `otools -L`.
  This has not been tested when libpgmath is linked in to f18.
- `wc` outputs spaces where on Linux it outputs tabs; change how
  the number of lines is extracted to work on both.

Also, fix a bug: change `passed_warnings` to `$passed_warnings`.

Original-commit: flang-compiler/f18@5bede9e188
Reviewed-on: https://github.com/flang-compiler/f18/pull/475
2019-06-03 13:21:35 -07:00
Tim Keith 829ea91949 [flang] Address more review comments
Original-commit: flang-compiler/f18@c7b3a39aa5
Reviewed-on: https://github.com/flang-compiler/f18/pull/462
2019-05-15 12:47:23 -07:00
Tim Keith 610438498c [flang] Fix typos, adjust nested list formatting
Original-commit: flang-compiler/f18@c07a86ce21
Reviewed-on: https://github.com/flang-compiler/f18/pull/462
Tree-same-pre-rewrite: false
2019-05-15 07:14:03 -07:00
Tim Keith 9e012ca714 [flang] Update description of semantic analysis
Semantics.md described the plans for semantic analysis as of some
time ago. Update it to document what has been implemented.

Original-commit: flang-compiler/f18@d32e340671
Reviewed-on: https://github.com/flang-compiler/f18/pull/462
Tree-same-pre-rewrite: false
2019-05-14 20:01:07 -07:00
peter klausler 710a5147cd [flang] Reformatting before merging
Original-commit: flang-compiler/f18@9f084c1da6
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
2019-05-30 16:39:23 -07:00
peter klausler c3ce68c1ee [flang] Two more fixes made while waiting for code review
Original-commit: flang-compiler/f18@6dc58004ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-30 16:14:24 -07:00
peter klausler 535484e2cc [flang] Address review comment
Original-commit: flang-compiler/f18@17be1f6a7d
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-30 15:26:54 -07:00
peter klausler d3b23e9dd6 [flang] Handle large integer literals without kinds better
Original-commit: flang-compiler/f18@381ea32d57
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-30 13:31:11 -07:00
peter klausler 616337dbf3 [flang] document non-support for PGI ALLOCATE(TYPE(t)::...)
Original-commit: flang-compiler/f18@67420da79c
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-30 12:08:06 -07:00
peter klausler d49aa3c57c [flang] Final fixes before review
Original-commit: flang-compiler/f18@efe5c1b8ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-29 16:00:31 -07:00
peter klausler f4b1209f4b [flang] PRECISION, RANGE, RADIX
Original-commit: flang-compiler/f18@de0bf5a18f
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-29 15:38:33 -07:00
peter klausler eff41b8fa7 [flang] Complete folding of intermixed array and component references
Original-commit: flang-compiler/f18@70db03e4ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-29 13:22:35 -07:00
peter klausler 4cd29d1002 [flang] Fix intrinsic folding after merging changes
Original-commit: flang-compiler/f18@a982c34b6f
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-28 15:42:28 -07:00
peter klausler d29530e1c4 [flang] Defer conversions to objects; fix some intrinsic table entries
more fixes

Access components of constant structures

Apply implicit typing to dummy args used in automatic array dimensions

SELECTED_INT_KIND and SELECTED_REAL_KIND

Finish SELECTED_{INT,REAL}_KIND and common cases of ALL()/ANY()

Original-commit: flang-compiler/f18@e9f8e53e55
Reviewed-on: https://github.com/flang-compiler/f18/pull/472
Tree-same-pre-rewrite: false
2019-05-28 13:29:29 -07:00
Jean Perier 0dfecfa8c5 [flang] Add semantic error test for integer constant containing division by zero
Original-commit: flang-compiler/f18@650cfac539
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
2019-05-24 08:22:11 -07:00
Jean Perier 33d6fb2332 [flang] Make integer divide by zero in constants a fatal error
Original-commit: flang-compiler/f18@e5acff6b63
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
Tree-same-pre-rewrite: false
2019-05-24 07:55:57 -07:00
Jean Perier 3e0e884338 [flang] removed a relicate comment
Original-commit: flang-compiler/f18@f25113b84e
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
Tree-same-pre-rewrite: false
2019-05-24 07:55:50 -07:00
Jean Perier 49c8d329b7 [flang] Fix support of parenthesized arguments in function folding
Original-commit: flang-compiler/f18@1ecb07cddf
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
Tree-same-pre-rewrite: false
2019-05-24 07:55:44 -07:00
Jean Perier fcf951b4d4 [flang] more folding edge cases tests
Original-commit: flang-compiler/f18@21c0ec4cc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
Tree-same-pre-rewrite: false
2019-05-24 07:55:42 -07:00
Jean Perier ccd47f072c [flang] Adding tests for folding edge case (overflows...)
Original-commit: flang-compiler/f18@6893775dee
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
Tree-same-pre-rewrite: false
2019-05-24 07:55:41 -07:00
Jean Perier f62528535e [flang] Folding improvments:
- Add location to non-fatal error message (context was not given
    a location before folding in semantics).
  - Avoid refolding expression from scratch several times (update GenericExprWrapper
    after folding). So far, warning messages were generated twice per parametere init
    expressions.

Original-commit: flang-compiler/f18@bf7f6cf9cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/468
Tree-same-pre-rewrite: false
2019-05-24 07:55:40 -07:00
Jinxin Yang 67ebc0064a [flang] improvement for atomic construct
Original-commit: flang-compiler/f18@d57ef4a669
Reviewed-on: https://github.com/flang-compiler/f18/pull/470
2019-05-24 13:54:58 -07:00
Jinxin Yang 083bc9c6a1 [flang] improvement for 'Re-write OpenMP 4.5 grammar doc with BNF'
Original-commit: flang-compiler/f18@e17e74104b
Reviewed-on: https://github.com/flang-compiler/f18/pull/470
Tree-same-pre-rewrite: false
2019-05-24 13:45:15 -07:00
Jinxin Yang 80c9995a19 [flang] Re-write OpenMP 4.5 grammar doc with BNF
Original-commit: flang-compiler/f18@fe06ea9f60
Reviewed-on: https://github.com/flang-compiler/f18/pull/470
Tree-same-pre-rewrite: false
2019-05-23 17:13:52 -07:00
Jean Perier 6bcb3cac84 [flang] add test for parameter infinite loop
Original-commit: flang-compiler/f18@552568c397
Reviewed-on: https://github.com/flang-compiler/f18/pull/469
2019-05-23 02:13:01 -07:00
Jean Perier e5f396511d [flang] fix error message typo
Original-commit: flang-compiler/f18@049163e0d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/469
Tree-same-pre-rewrite: false
2019-05-23 02:09:58 -07:00
Jean Perier 15630a4ddd [flang] Prevent possible infinte loop in parameter folding
Original-commit: flang-compiler/f18@38360930ce
Reviewed-on: https://github.com/flang-compiler/f18/pull/469
Tree-same-pre-rewrite: false
2019-05-22 08:26:50 -07:00
Peter Klausler 849597f4f9 [flang] Update FortranForCProgrammers.md
Refine the text describing differences between C and Fortran pointers to correct an erroneous statement (that pointers cannot point to allocatables).  Fixes bug flang-compiler/f18#461.

Original-commit: flang-compiler/f18@eaa3c10aa8
Reviewed-on: https://github.com/flang-compiler/f18/pull/464
2019-05-15 13:37:10 -07:00
Jean Perier d146db54ca [flang] Fix: catch subroutine symbols in ALLOCATE
Original-commit: flang-compiler/f18@99d4b3dcd6
Reviewed-on: https://github.com/flang-compiler/f18/pull/467
2019-05-22 08:00:19 -07:00
peter klausler 7026445c07 [flang] Address review comments from Jean (thanks!)
Original-commit: flang-compiler/f18@5183c6196e
Reviewed-on: https://github.com/flang-compiler/f18/pull/466
2019-05-21 10:24:30 -07:00
peter klausler 59342b0641 [flang] work in progress
checkpoint: changes build, tests all pass

many fixes, ready to test more

Further CLASS(*) support

More fixes for CLASS(*)

Hide data members of DynamicType

implement PRESENT() intrinsic

Original-commit: flang-compiler/f18@044ba12c20
Reviewed-on: https://github.com/flang-compiler/f18/pull/466
Tree-same-pre-rewrite: false
2019-05-20 13:37:28 -07:00
peter klausler d0fcb7681a [flang] Fix crash reported by Tim
Original-commit: flang-compiler/f18@7fe2d197ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/465
2019-05-15 13:23:31 -07:00
peter klausler 9a13ea959c [flang] Fix bug with comment clipping on compiler directives
Original-commit: flang-compiler/f18@3f4375c57c
Reviewed-on: https://github.com/flang-compiler/f18/pull/463
2019-05-15 12:35:36 -07:00
peter klausler 01a3e1b80e [flang] Strip comments from source and directive lines after macro replacement
Original-commit: flang-compiler/f18@ecf22e6698
Reviewed-on: https://github.com/flang-compiler/f18/pull/460
2019-05-10 16:04:10 -07:00
Tim Keith cae5ce3d27 [flang] Update extensions doc for DO loop over REAL
Original-commit: flang-compiler/f18@bc8ea466fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
2019-05-09 10:04:46 -07:00
Tim Keith 4c4f4d2807 [flang] Address review comments
Use better names for template parameters of `LoopBounds`, and also
for the constructor arguments.

Use two overloadings of `loopBounds()` instead of `std::is_same_v<>`.

Original-commit: flang-compiler/f18@a2c0c75462
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
Tree-same-pre-rewrite: false
2019-05-09 10:00:13 -07:00
Tim Keith 351dc98948 [flang] Change parse tree to allow DO loop over REAL
It is a common extension to allow DO loops with REAL variable and
bounds. The parse tree currently parses those with the variable
as `scalar-int-variable-name` and the bounds as `scalar-int-expr`.
That causes the INTEGER constraint to be enforced automatically.

Change the grammar and parse tree to treat them as `scalar-variable-name`
and `scalar-expr`. This allows the name and expression to be REAL,
but we will have to verify that they aren't any other type (in a future
change).

To accomplish this, add a template parameter to `LoopBounds` for the type
of the variable name (always `Scalar<Name>` or `Scalar<Integer<Name>>`).
We sometimes need names for the instantiations of `LoopBounds` so add
type aliases like `LoopControl::Bounds` for each one.

Original-commit: flang-compiler/f18@d75aa03970
Reviewed-on: https://github.com/flang-compiler/f18/pull/455
Tree-same-pre-rewrite: false
2019-05-09 08:33:28 -07:00
Peter Steinfeld 3cf2173010 [flang] Added a TODO to include the name of the IMPURE procedure in the error
message for referencing in IMPURE procedure in the scalar-mask-expr of
a DO CONCURRENT.

Also removed a bogus comment from the test.

Both of these changes were in response to review comments.

Original-commit: flang-compiler/f18@4447d59b39
Reviewed-on: https://github.com/flang-compiler/f18/pull/452
2019-05-09 10:58:55 -07:00
Peter Steinfeld c2346d9ee2 [flang] Added a test for C1121 -- in a concurrent DO loop, the
scalar-mask-expr cannot reference an IMPURE procedure.

Original-commit: flang-compiler/f18@0684c6ccc2
Reviewed-on: https://github.com/flang-compiler/f18/pull/452
Tree-same-pre-rewrite: false
2019-05-09 10:58:54 -07:00
Jinxin Yang d25c942594 [flang] OpenMP 4.5 grammar related minor fixes
1. typo and trailing spaces within OpenMP-4.5-grammar.txt

2. parse (openmp-grammar.h) and unparse(unparse.cc) for:

   SCHEDULE ([modifier [, modifier]:]kind[, chunk_size])
   Modifier ->  MONITONIC | NONMONOTONIC | SIMD

where ":" is optional except at least one modifier is present.

Original-commit: flang-compiler/f18@5cebae5039
Reviewed-on: https://github.com/flang-compiler/f18/pull/453
2019-05-08 14:12:28 -07:00
peter klausler 802895b7c6 [flang] Allow use of (x?"a":"b") as a message argument
Original-commit: flang-compiler/f18@c0d4e55455
Reviewed-on: https://github.com/flang-compiler/f18/pull/451
2019-05-08 11:11:11 -07:00
peter klausler 40282fabd2 [flang] Add & use mutators for Substring, Triplet, CoarrayRef
Original-commit: flang-compiler/f18@cc2de361fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
2019-05-08 10:29:04 -07:00
peter klausler b00798b64f [flang] Fix warning
Original-commit: flang-compiler/f18@4fcf88901c
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false
2019-05-08 10:29:02 -07:00
peter klausler d92abfa65e [flang] Address review comment
Original-commit: flang-compiler/f18@5d20cd48b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false
2019-05-08 10:29:02 -07:00
peter klausler 91de1f62fb [flang] dodge clang build problem with constexpr
Original-commit: flang-compiler/f18@83995a5a98
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false
2019-05-08 10:29:01 -07:00
peter klausler 04d85f1754 [flang] Remove debugging
Original-commit: flang-compiler/f18@1db626f838
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false
2019-05-08 10:28:58 -07:00
peter klausler bb83471e96 [flang] Fix folding of substring
Original-commit: flang-compiler/f18@62dc5e0c93
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false
2019-05-08 10:28:57 -07:00
peter klausler 52d46695fc [flang] Handle remaining cases in expression traversal
Original-commit: flang-compiler/f18@5cb0de58d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/449
Tree-same-pre-rewrite: false
2019-05-08 10:28:56 -07:00