Commit graph

1242 commits

Author SHA1 Message Date
peter klausler
475d72f8e6 [flang] push for review
Original-commit: flang-compiler/f18@17dc735911
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 14:26:23 -08:00
peter klausler
4417443be9 [flang] Fix CHECK() on wa22 by implementing PGI language extension
Original-commit: flang-compiler/f18@03fcb58977
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:29:10 -08:00
peter klausler
2f12ee4f52 [flang] complete transfer of struct constructor code to expression.cc
Original-commit: flang-compiler/f18@e6178b2fc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:29:07 -08:00
peter klausler
f5bc9fd1d1 [flang] checkpoint, much code moved out of name resolution
Original-commit: flang-compiler/f18@8a081e82fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:28:09 -08:00
peter klausler
115d3cdf52 [flang] catch up with master
Original-commit: flang-compiler/f18@e66ef3699c
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:24:17 -08:00
peter klausler
4d1a8a3ac8 [flang] checkpoint, tests pass
Original-commit: flang-compiler/f18@d90d5d9244
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:24:13 -08:00
peter klausler
a412dce037 [flang] checkpoint
Original-commit: flang-compiler/f18@6146957713
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:13 -08:00
peter klausler
83a8530612 [flang] Rework Constant<character>
Original-commit: flang-compiler/f18@fc807bfd7d
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:12 -08:00
peter klausler
5b79ffc5f6 [flang] checkpoint
Original-commit: flang-compiler/f18@156791b288
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:10 -08:00
peter klausler
4313f4c762 [flang] checkpoint array/struct constructor work
Original-commit: flang-compiler/f18@b0a574fa35
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:09 -08:00
peter klausler
25807d88f4 [flang] merged with new master
Original-commit: flang-compiler/f18@03944d5052
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:06 -08:00
peter klausler
e8709a4d6a [flang] checkpoint Constant<SomeDerived> based on StructureConstructor
Original-commit: flang-compiler/f18@47986f0c7e
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:05 -08:00
peter klausler
d3559a5d18 [flang] Name resolution for structure constructors
Original-commit: flang-compiler/f18@9d60038f03
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:04 -08:00
peter klausler
6d47e5ab4d [flang] Eliminate DerivedTypeDetails::extends_ since it is front of component list
Original-commit: flang-compiler/f18@15150225f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:03 -08:00
peter klausler
509436cab1 [flang] begin work on structure constructors
Original-commit: flang-compiler/f18@7131a2f91d
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:02 -08:00
Tim Keith
0cba9a9301 [flang] Merge pull request flang-compiler/f18#286 from flang-compiler/tsk3
Add support for common blocks

Original-commit: flang-compiler/f18@6a37805094
Reviewed-on: https://github.com/flang-compiler/f18/pull/286
2019-02-15 10:24:51 -08:00
Tim Keith
543b15bca4 [flang] Add support for common blocks
A symbol for a common block has `CommonBlockDetails` which contains
a list of the symbols that are in the common block.

The name of the symbol for the blank common block is the empty string.
That preserves the property that every symbol name is a substring of
the cooked source. We use the 0-length substring starting at the COMMON
statement so that when symbols are sorted by the location of the start
of the name it ends up in the right place.

Some of the checks on members of common blocks don't happen until the
end of the scope. They can't happen earlier because we don't necessarily
know the type and attributes.

Enhance `test_errors.sh` so that multiple errors can be expected for
a single line.

Original-commit: flang-compiler/f18@2c4ca6b5d3
Reviewed-on: https://github.com/flang-compiler/f18/pull/286
2019-02-14 07:59:20 -08:00
Tim Keith
288bd16527 [flang] Merge pull request flang-compiler/f18#282 from flang-compiler/tsk1
Document describing overview of compiler phases

Original-commit: flang-compiler/f18@9648645634
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
2019-02-14 08:41:03 -08:00
Tim Keith
bdfff2e52d [flang] Address rest of review comments
Original-commit: flang-compiler/f18@3aa7303a30
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
2019-02-14 08:40:19 -08:00
Tim Keith
bacbfce78b [flang] Address review comments
Original-commit: flang-compiler/f18@6b42a1777f
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
Tree-same-pre-rewrite: false
2019-02-12 10:40:52 -08:00
Tim Keith
123896d5bb [flang] Document describing overview of compiler phases
Original-commit: flang-compiler/f18@ac7a492a25
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
Tree-same-pre-rewrite: false
2019-02-11 16:33:20 -08:00
Tim Keith
04b95d546d [flang] Merge pull request flang-compiler/f18#284 from flang-compiler/tsk3
Simplify CommonStmt in parse tree

Original-commit: flang-compiler/f18@5f5430af33
Reviewed-on: https://github.com/flang-compiler/f18/pull/284
2019-02-12 16:22:15 -08:00
Tim Keith
b60fd092f5 [flang] Simplify CommonStmt in parse tree
The grammar requires parsing the first common block in a common stmt
differently from the others: the '//' is optional for the blank common.

But once it's parsed, it is easier to work with if each is represented
as a `parser::CommonStmt::Block`. This is achieved by using the same
constructor for `CommonStmt` but then including the first block in
the list of blocks.

Original-commit: flang-compiler/f18@dd46afd6b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/284
2019-02-12 16:13:58 -08:00
Tim Keith
c2c0438b6e [flang] Merge pull request flang-compiler/f18#281 from flang-compiler/tsk4
More name resolution improvements

Original-commit: flang-compiler/f18@4466041ad0
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
2019-02-12 16:18:41 -08:00
Tim Keith
b7412d0174 [flang] Strengthen checking for unresolved names
Make it a fatal error to have an unresolved name, except for a few
exceptions.

Remove namelist, bind, save statements from the exceptions.

Original-commit: flang-compiler/f18@b16cbed780
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
2019-02-11 10:58:20 -08:00
Tim Keith
e5965b4752 [flang] Fix bug setting type from association expression
When an association selector is an expression, we get the type of the
associate-name from the type of the expression. If that is a derived
type, we were failing to get the derived type scope in copy of the
type that was made. That meant the component names were not resolved.

The fix is to copy the scope in the copy and move constructors of
`DerivedTypeSpec`. As a result, `DerivedTypeSpec::Instantiate` cannot
assume that the `scope_` is not set.

Original-commit: flang-compiler/f18@79eaa8c47f
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
2019-02-11 10:49:48 -08:00
Tim Keith
3ecf8ef241 [flang] Always resolve associate-name in select-type
Even if the selector expression has an error, we can resolve the
associate-name.

Original-commit: flang-compiler/f18@3c35c30f58
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
2019-02-08 16:17:52 -08:00
Tim Keith
d396a8845b [flang] Resolve kind parameters on literal constants
When the kind parameter is a constant name, that name must be resolved.

Add `CheckIntrinsicKind` and `CheckIntrinsicSize` for common checking of
valid intrinsic kinds. Previous we had different forms of the error
message depending on the context ( "unsupported INTEGER(KIND=47)" and
"INTEGER(KIND=47) is not a supported type").

Report error for parameters without initialization where are they
declared (in `Post(EntityDecl)`) rather than where they are referenced
(in `AnalyzeExpr`).

Remove error message from `AnalyzeKindParam`: `AnalyzeExpr` will report
the error (e.g. not integer, not constant, etc.).

Remove "name was not resolved" error from `AnalyzeExpr`: it should be
reported by name resolution.

Original-commit: flang-compiler/f18@9b0a99ce66
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
2019-02-08 16:03:23 -08:00
Tim Keith
69369e3b52 [flang] Resolve binding names in type-bound generic
Enhance `FindInTypeOrParents()` to also accept a `parser::Name` argument
and to resolve that name when the symbol is found. This causes binding
names in type-bound generic statements to be resolved. Move this process
to the beginning of the handling of such statements so that they are
resolve even if the generic spec is not and we return early.

Also resolve type parameter keywords in derived type specs
(e.g. `k` in `type(k=1) :: x`). That involves collecting and searching
the symbols of the `TypeParamDetails` to match the name with the symbol.

Original-commit: flang-compiler/f18@7387fb436d
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
2019-02-08 08:57:28 -08:00
Eric Schweitz
01377d5542 [flang] Merge pull request flang-compiler/f18#280 from flang-compiler/eas6
Fix for both issues 274 and 278

Original-commit: flang-compiler/f18@3dc5b01a3f
Reviewed-on: https://github.com/flang-compiler/f18/pull/280
2019-02-08 12:01:03 -08:00
Eric Schweitz
a12981c776 [flang] Fix for both issues 274 and 278
Original-commit: flang-compiler/f18@9bb54046c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/280
2019-02-08 10:53:18 -08:00
Eric Schweitz
3d7044baef [flang] Merge pull request flang-compiler/f18#279 from flang-compiler/eas5
Fixes infinite loop in tests

Original-commit: flang-compiler/f18@85cf54e985
Reviewed-on: https://github.com/flang-compiler/f18/pull/279
2019-02-07 16:58:19 -08:00
Eric Schweitz
748860b684 [flang] Fixes infinite loop in tests
Original-commit: flang-compiler/f18@2fa96b7734
Reviewed-on: https://github.com/flang-compiler/f18/pull/279
2019-02-07 16:41:18 -08:00
Tim Keith
922ae38b83 [flang] Merge pull request flang-compiler/f18#277 from flang-compiler/tsk4c
Name resolution for namelist and data statements

Original-commit: flang-compiler/f18@c6d4360f3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
2019-02-07 12:27:25 -08:00
Tim Keith
d0d92e4eff [flang] Address review comments
Original-commit: flang-compiler/f18@9daa2351c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
2019-02-07 12:25:59 -08:00
Tim Keith
2a43e78c17 [flang] Improvements to name resolution in data statements
Handle variables in data statements differently from implied dos:
If a variable is first mentioned in a data statement, it is implicitly
declared in the current scope (and subsequent type declarations only
confirm the type).
In the implied do case, the only variables that can be implicitly
declared are the iteration variables. They must be created in the new
ImpliedDos scope. There must be one such scope for each data-stmt-object
because the variable name can be reused.

Resolve references to named constants, e.g. in complex-literal-constant
and data-stmt-value. This requires changing the handling of
named-constant-def as that is a definition, not a reference.

Original-commit: flang-compiler/f18@9952b56af0
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
2019-02-06 17:18:02 -08:00
Tim Keith
7c4e86b7e2 [flang] Add Symbol::IsArray()
Add and use IsArray for symbols, meaning: it is an object entity
with shape.

Original-commit: flang-compiler/f18@31c1a37f03
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
2019-02-06 10:28:31 -08:00
Tim Keith
da46e49a01 [flang] Resolve namelist group and object names
Namelist groups are represents by symbols with `NamelistDetails`.
Those contain a list of symbols representing the objects in the group.
References to namelist groups in io-control-spec are resolved.

In `.mod` files, namelist groups are written out at the end of the
module specification section. This is so that the declarations of the
objects in the namelist group appear before they are referenced.

Original-commit: flang-compiler/f18@8b70dbcac7
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
2019-02-05 14:43:00 -08:00
Tim Keith
be6e03ec90 [flang] Add SayWithDecl function for error reporting
Add `SayWithDecl` to handle the common case of reporting an error about
a symbol and referencing its original declaration.

Original-commit: flang-compiler/f18@cf4d6fbe7f
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
2019-02-05 13:51:36 -08:00
Eric Schweitz
332c9a707f [flang] Merge pull request flang-compiler/f18#276 from flang-compiler/eas3
Issue flang-compiler/f18#274 - add separate scopes for each procedure in the module

Original-commit: flang-compiler/f18@64e175ceb0
Reviewed-on: https://github.com/flang-compiler/f18/pull/276
2019-02-05 16:55:22 -08:00
Eric Schweitz
a67099adbf [flang] identifier conformity
Original-commit: flang-compiler/f18@7d6e28f699
Reviewed-on: https://github.com/flang-compiler/f18/pull/276
2019-02-05 10:27:32 -08:00
Eric Schweitz
5c5fda8680 [flang] Issue flang-compiler/f18#274 - add separate scopes for each procedure in the module
Original-commit: flang-compiler/f18@d8f6b66178
Reviewed-on: https://github.com/flang-compiler/f18/pull/276
Tree-same-pre-rewrite: false
2019-02-05 09:43:51 -08:00
Peter Klausler
4faaf7a75f [flang] Merge pull request flang-compiler/f18#271 from flang-compiler/pmk-exprs
Semantic analysis & folding of array constructors

Original-commit: flang-compiler/f18@00be335567
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
2019-02-04 13:38:08 -08:00
peter klausler
56bf4f8e0f [flang] fix crash found by tim
Original-commit: flang-compiler/f18@c24120d811
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
2019-02-04 13:06:21 -08:00
peter klausler
7f7c44f425 [flang] address comments
Original-commit: flang-compiler/f18@ccbb1a2036
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-02-04 10:39:41 -08:00
peter klausler
fef7fcd45f [flang] More value semantics in Constant<> and GetScalarConstantValue
Original-commit: flang-compiler/f18@c7acce4685
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-02-01 13:37:49 -08:00
peter klausler
6d8aecf981 [flang] Convert structs to classes, move some defs from variable.h to call.h
Original-commit: flang-compiler/f18@c877a34694
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 16:04:17 -08:00
peter klausler
981921f47a [flang] fix f90_correct failure
Original-commit: flang-compiler/f18@1d9dac8ab5
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 13:18:30 -08:00
peter klausler
8c5d6b99de [flang] Fix instantiation of PDT bindings
Original-commit: flang-compiler/f18@8dcfe0c70b
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 11:44:13 -08:00
peter klausler
ef77d38c21 [flang] add conversions to array constructor test
Original-commit: flang-compiler/f18@881c195a26
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 10:16:26 -08:00