Commit graph

974 commits

Author SHA1 Message Date
Tim Keith
903730721a [flang] Address review comments
Original-commit: flang-compiler/f18@2ca329b85a
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
2018-09-05 16:02:41 -07:00
Tim Keith
91168ff9be [flang] Resolve derived type parameters
Add TypeParamDetails for symbols that represent type parameters.
Create such symbols when a type-param-def-stmt is encountered.

At the end of the derived-type-def, check the parameters named
in the type-param-name-list against those encountered in each
type-param-def-stmt.

Original-commit: flang-compiler/f18@c15247bb30
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-09-04 10:28:27 -07:00
Tim Keith
1b50885a3f [flang] Move KindOrLen enum to common/fortran.h
This is so that it can more easily be used in semantics in the
representation of type parameters.

Original-commit: flang-compiler/f18@f734d754e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-09-04 10:26:31 -07:00
Tim Keith
e0b94a84c3 [flang] Resolve procedure bindings and final procedures in derived types
Add new kinds of symbol details: ProcBindingDetails, FinalProcDetails.
and GenericBindingDetails. The last is not yet implemented.
Write them to the .mod file.

Recognize DEFERRED and NON_OVERRIDABLE attributes. Enforce C783.

Resolve CLASS(t) similarly to resolution of TYPE(t).

Original-commit: flang-compiler/f18@0c0a9ab79e
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-08-31 16:20:00 -07:00
Tim Keith
b8efe4bf11 [flang] Change BeginAttrs to return true like BeginDecl
This is just for convenience. Any Pre function that calls BeginAttrs
must return true.

Original-commit: flang-compiler/f18@5a7bc11ba4
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-08-31 15:15:28 -07:00
Tim Keith
f69f7ecf48 [flang] Small improvements to name resolution
Resolve names and do implicit typing in ArrayElement and LoopBounds.

Fix problem with creation of UseErrorDetails: when a conflict occurs,
record both the original USE and the new one.

Resolve the type name in TypeAttrSpec::Extends. Move CheckUseError to
DeclarationVisitor so that it can be used in ResolveDerivedType.

Report error on unresolved names. I.e. after name resolution, check each
parser::Name and verify we have a Symbol for it. This is on by default
now but it could be an option.

Original-commit: flang-compiler/f18@1c8cbc6e53
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-08-29 11:38:12 -07:00
Tim Keith
2579c3a4cf [flang] Small code cleanups
Use brace-initialization more consistently.
Use std::is_same_v instead of std::is_same and "if constexpr".

Original-commit: flang-compiler/f18@7f461faf9a
Reviewed-on: https://github.com/flang-compiler/f18/pull/173
Tree-same-pre-rewrite: false
2018-08-28 14:02:53 -07:00
Peter Klausler
a8276a32a9 [flang] Merge pull request flang-compiler/f18#172 from flang-compiler/pmk1
Resolve two parsing ambiguities from sscalpone

Original-commit: flang-compiler/f18@17035bb789
Reviewed-on: https://github.com/flang-compiler/f18/pull/172
2018-09-04 12:05:33 -07:00
peter klausler
53fef0b36c [flang] Fix parsing ambiguity with pointer assignment statements
Original-commit: flang-compiler/f18@42eb1b140d
Reviewed-on: https://github.com/flang-compiler/f18/pull/172
2018-09-04 11:55:27 -07:00
peter klausler
df13a8fcee [flang] Fix parsing ambiguity: MODULESUBROUTINEFOO at top level
Original-commit: flang-compiler/f18@cfda0945ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/172
Tree-same-pre-rewrite: false
2018-09-04 11:55:27 -07:00
peter klausler
eea5287a3c [flang] Better error recovery when END TYPE is expected but only END appears.
Original-commit: flang-compiler/f18@7b70829d41
2018-09-04 11:42:10 -07:00
peter klausler
8cde753c36 [flang] improve error recovery for missequenced IMPORT and IMPLICIT
Original-commit: flang-compiler/f18@a096fc8604
2018-09-04 11:13:47 -07:00
Tim Keith
b6db93447a [flang] Merge pull request flang-compiler/f18#169 from flang-compiler/tsk1
Add support for BLOCK construct

Original-commit: flang-compiler/f18@e9abdbc993
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
2018-08-28 11:50:45 -07:00
Tim Keith
7f9106a816 [flang] Improve comments on class ImplicitRules
Original-commit: flang-compiler/f18@926dc2bed1
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
2018-08-27 13:32:10 -07:00
Tim Keith
348921b40e [flang] Remove unused variable
Original-commit: flang-compiler/f18@05dc053442
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false
2018-08-27 12:12:03 -07:00
Tim Keith
13e9617ea2 [flang] Add support for BLOCK construct
A `BLOCK` statement opens a new scope. It is different from other scopes
in that implicitly typed entities are defined in the enclosing non-block
scope, not immediately in the block. This means that `IMPORT` statements
can cause them to be hidden.

Check that blocks can't have `IMPLICIT` statements in them. It is simpler
for the parser not to deal with the different between a
specification-part and a block-specification-part.

Change `ImplicitRules` to have a parent that is consulted when there isn't
an answer in the current one. For an interface body that does not happen
but for all other nested scopes it does. This parent link eliminates the
need for the `implicitRules_` stack. Make `isImplicitNoneType_` and
`isImplicitNoneExternal_` optional: not set means look in parent.
Fixes flang-compiler/f18#71.

Remove `CurrNonTypeScope()` and put the logic in `Symbol::FindSymbol`.

Original-commit: flang-compiler/f18@a153a2ee33
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false
2018-08-27 11:48:49 -07:00
Eric Schweitz
0abba67179 [flang] Merge pull request flang-compiler/f18#171 from flang-compiler/easdd2
Design document for label resolution pass

Original-commit: flang-compiler/f18@3e97e7922e
Reviewed-on: https://github.com/flang-compiler/f18/pull/171
2018-08-28 10:44:20 -07:00
Eric Schweitz
a4331e23ac [flang] Add the detailed design for label resolution
Original-commit: flang-compiler/f18@89c4b70b55
Reviewed-on: https://github.com/flang-compiler/f18/pull/171
2018-08-28 10:17:38 -07:00
Tim Keith
298dbe57ee [flang] Merge pull request flang-compiler/f18#167 from flang-compiler/tsk1
Implement host association and import statements

Original-commit: flang-compiler/f18@354a594b0b
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
2018-08-23 11:59:34 -07:00
Tim Keith
37476ee32e [flang] Add common::ImportKind
Replace parser::ImportStmt::Kind and semantics::Scope::ImportKind with a
single enum class in common/fortran.h. This eliminates the need to map
between the parser enum and the semantics enum.

Original-commit: flang-compiler/f18@779a99314c
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
2018-08-23 11:45:49 -07:00
Tim Keith
364aed2109 [flang] Address review comments
Original-commit: flang-compiler/f18@c30cbc8158
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-23 11:24:12 -07:00
Tim Keith
d82ec6eb23 [flang] Add another host-associate test
Verify that a derived type component does not hide a type of the same
name in its host.

Original-commit: flang-compiler/f18@212d84cb2f
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-23 07:41:06 -07:00
Tim Keith
3fc79bbc96 [flang] Code cleanup
`CurrScope()` is now a simple accessor with no logic, so rename to `currScope()`.

`PushScope()` doesn't need to return a `Scope&` and the other functions
with that name do not, so make it consistent.

Original-commit: flang-compiler/f18@c8c341be14
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-22 16:56:57 -07:00
Tim Keith
7cfad97f23 [flang] Add missing copyrights.
Original-commit: flang-compiler/f18@a9346a588a
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-22 16:05:53 -07:00
Tim Keith
5b39e7da10 [flang] Implement host association and import statements
Host association is done by search for symbols using `Scope::FindSymbol()`
which looks for the the name in the parent scope if the import rules
permit it.

Import statements are implemented using `importKind_` and `importNames_`
in class `Scope`. Most of the constraints are checked when the
`ImportStmt` is encountered. `CheckImports()` is called at the end of
the `SpecificationPart` to verify the names mentioned in the IMPORT
statement. That has to happen then so that we can detect if an imported
name is hidden by a declaration in the current scope.

Original-commit: flang-compiler/f18@0d50c8a8ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-22 16:05:06 -07:00
Tim Keith
44937f6321 [flang] Replace scope stack with current scope
We don't need to manage a stack of scopes: each scope has a reference to
its parent, so popping the scope stack is equivalent to setting the
new current scope to the parent of the old current scope.

Original-commit: flang-compiler/f18@022aa7a7f9
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-09 17:12:31 -07:00
Tim Keith
4cd3eb3c4a [flang] Collect names of internal subprograms of a MainProgram
... as is done for other internal subprograms.

Original-commit: flang-compiler/f18@079f45d51b
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-09 15:25:45 -07:00
Peter Klausler
08f0877760 [flang] Merge pull request flang-compiler/f18#166 from flang-compiler/pmk1
fix sloppy merge (sorry)

Original-commit: flang-compiler/f18@c3957893cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/166
2018-08-09 14:16:02 -07:00
peter klausler
c2f56d0fb4 [flang] fix sloppy merge (sorry)
Original-commit: flang-compiler/f18@b475721e09
Reviewed-on: https://github.com/flang-compiler/f18/pull/166
2018-08-09 13:09:33 -07:00
Peter Klausler
d86a81343c [flang] Merge pull request flang-compiler/f18#165 from flang-compiler/pmk0
Expression analysis and message clean-up

Original-commit: flang-compiler/f18@9fa1c429f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
2018-08-09 12:50:15 -07:00
peter klausler
27753b8b98 [flang] Canonicalize nonstandard BOZ literals to avoid spurious parse/unparse/reparse/unparse failures.
Original-commit: flang-compiler/f18@d651990632
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
2018-08-09 10:17:44 -07:00
peter klausler
9e90c99e43 [flang] More expression analysis of literal constants.
Original-commit: flang-compiler/f18@3c89dace19
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:43 -07:00
peter klausler
62436d06cc [flang] Add data to a new formatted message.
Original-commit: flang-compiler/f18@04b1ae9e68
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:43 -07:00
peter klausler
ce231b9559 [flang] Clean up messaging: make Say() member function templates more flexible, hide MessageFormattedText instances
Original-commit: flang-compiler/f18@59d774382f
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:40 -07:00
peter klausler
27be6855bf [flang] Expression analysis
Original-commit: flang-compiler/f18@6b5e23ba28
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:15:03 -07:00
Tim Keith
ce0b722997 [flang] Merge pull request flang-compiler/f18#164 from flang-compiler/tsk9
Module file improvements

Original-commit: flang-compiler/f18@61598b59b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
2018-08-09 10:13:13 -07:00
Tim Keith
86a76d56ba [flang] Address review comments.
Original-commit: flang-compiler/f18@797ea41e17
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
2018-08-08 14:52:45 -07:00
Tim Keith
3d43ea663b [flang] Module file improvements
Verify that checksums are correct when reading a module file.

Don't write a module file if its current contents are correct.

Don't make .mod files read-only. It doesn't do much to prevent
users from editing them, checksum verification will detect when
it happens, and having them read-only causes problems if you then
compile with another compiler (e.g. PGI).

Original-commit: flang-compiler/f18@21d82aef6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
Tree-same-pre-rewrite: false
2018-08-08 11:36:24 -07:00
Peter Klausler
70dfdf979d [flang] Merge pull request flang-compiler/f18#162 from flang-compiler/pmk0
Roll up work on folding, descriptors, runtime, RESHAPE

Original-commit: flang-compiler/f18@967a334d72
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
2018-08-06 09:54:44 -07:00
peter klausler
d2703b38e5 [flang] address review comments
Original-commit: flang-compiler/f18@a98942e396
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
2018-08-06 09:43:43 -07:00
peter klausler
d4b12d4e84 [flang] Remove defined assignments from runtime representation.
Original-commit: flang-compiler/f18@720e71c5db
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:55:36 -07:00
peter klausler
3ace3e39c6 [flang] Rename some NaNs.
Original-commit: flang-compiler/f18@34eac17ddc
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:03 -07:00
peter klausler
9859b91602 [flang] clean up g++ 8.2.0 build warnings
Original-commit: flang-compiler/f18@0c946bef66
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:02 -07:00
peter klausler
fac96c4612 [flang] test and debug RESHAPE
Original-commit: flang-compiler/f18@c20ce350c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:02 -07:00
peter klausler
a8fed82258 [flang] Implement and test RESHAPE. Avoid G++ workaround when compiled with GNU 8.2.0.
Original-commit: flang-compiler/f18@80257ee0d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:01 -07:00
peter klausler
6f9fa21d50 [flang] Move descriptor flags into addendum.
Original-commit: flang-compiler/f18@f5839874ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:00 -07:00
peter klausler
51b3ceaafe [flang] Use a common enum class in evaluate and runtime for type category.
Original-commit: flang-compiler/f18@5012e652af
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:00 -07:00
peter klausler
2dce7b9554 [flang] break up runtime into multiple headers and source files
Original-commit: flang-compiler/f18@7863350552
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:59 -07:00
peter klausler
79c74948cc [flang] more descriptor work
Original-commit: flang-compiler/f18@0ab17048ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:59 -07:00
peter klausler
e20784149f [flang] comments
Original-commit: flang-compiler/f18@b4423e3b1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:59 -07:00