Commit graph

1087 commits

Author SHA1 Message Date
psteinfeld
5f29e4f0b8 [flang] Update and rename Fortran-ir.md to FortranIR.md
Original-commit: flang-compiler/f18@00a99b81e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 10:23:55 -08:00
psteinfeld
1b50ccdbab [flang] Update README.md
Original-commit: flang-compiler/f18@230e9ad3a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 09:39:27 -08:00
psteinfeld
c09752d9a2 [flang] Rename semantics.md to Semantics.md
Original-commit: flang-compiler/f18@98dd9af648
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:10:47 -08:00
psteinfeld
f7499cceb7 [flang] Rename preprocessing.md to Preprocessing.md
Original-commit: flang-compiler/f18@ad305fd2d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:10:14 -08:00
psteinfeld
4bea65e46d [flang] Rename parsing.md to Parsing.md
Original-commit: flang-compiler/f18@d547949caa
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:09:46 -08:00
psteinfeld
ffaf307ffd [flang] Rename mod-files.md to Mod-files.md
Original-commit: flang-compiler/f18@92ba4284e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:09:12 -08:00
psteinfeld
74a0b49303 [flang] Rename intrinsics.md to Intrinsics.md
Original-commit: flang-compiler/f18@1d2bcb2183
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:08:43 -08:00
psteinfeld
de2ab788e5 [flang] Rename fortran-ir.md to Fortran-ir.md
Original-commit: flang-compiler/f18@f597e03e9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:08:11 -08:00
psteinfeld
f8b14542d2 [flang] Rename extensions.md to Extensions.md
Original-commit: flang-compiler/f18@6f935754b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:07:27 -08:00
psteinfeld
7bc25c7bdc [flang] Rename directives.md to Directives.md
Original-commit: flang-compiler/f18@752d757e1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 08:06:04 -08:00
Tim Keith
8b3783e2ea [flang] Fix build problem with clang
Moving one of the `Pre(ImplicitStmt)` functions up to
`DeclarationVisitor` seemed to cause clang to complain that the `Pre`
call from the `Walk` function was ambiguous. So this change moves
it back to `ResolveNameVisitor`.

Also, remove an unused variable that was causing a warning.

Original-commit: flang-compiler/f18@766d000e25
Reviewed-on: https://github.com/flang-compiler/f18/pull/299
2019-02-21 19:14:28 -08:00
Tim Keith
b6eb981caa [flang] Handle SAVE attribute and statement
As with COMMON blocks, we can't completely check SAVE statements and
attributes until the end of the specification part when we have seen
full declarations of entities. So when SAVE is specified, add it to one
of the two sets in `saveInfo_`. At the end of the specification part,
check that those entities can have SAVE applied and set it if it is
not already implicitly set (e.g. due to being in a module). Also apply
the "global" SAVE if present (i.e. setting it on every applicable
entity).

Add `IsDummy()` and `IsFuncResult()` to `Symbol` to simplify some of
the checks. Also detect attempts to put a function result in a common
block.

Original-commit: flang-compiler/f18@af19c02bac
Reviewed-on: https://github.com/flang-compiler/f18/pull/298
2019-02-21 08:59:38 -08:00
Tim Keith
efd7bdb030 [flang] Remove TODO for saved-entity
The parser can't distinguish `saved-entity -> object-name` from
`saved-entity -> proc-pointer-name`. So just use `kind` == `Entity`
for those cases. Name resolution will verify it is the right kind
of entity name.

Original-commit: flang-compiler/f18@69d7c0e025
Reviewed-on: https://github.com/flang-compiler/f18/pull/298
Tree-same-pre-rewrite: false
2019-02-21 08:48:30 -08:00
Tim Keith
a6874f8ee8 [flang] More work on COMMON blocks
Common block names can't clash with other names, so add `commonBlocks_`
to `Scope` to record the common blocks of a scoping unit. This requires
changes to how scopes are dumped and written to `.mod` files.

Support common blocks in BIND statements. Add optional bind-name to
`CommonBlockDetails`.

Add `CheckNotInBlock()` for checking statements that are not allowed in
block constructs.

In `rewrite-parse-tree.cc`, no longer skip check for resolved names in
common statements. But do skip the checks in compiler directives.

Original-commit: flang-compiler/f18@805a1ffd9b
Reviewed-on: https://github.com/flang-compiler/f18/pull/298
Tree-same-pre-rewrite: false
2019-02-21 08:48:20 -08:00
Tim Keith
8a03a67cb0 [flang] Change handling of BIND attributes
Previously `BIND(C, NAME="...")` caused `bindName` to be set but not
the `BIND` attribute. This made writing the `.mod` file easier, but it
makes it hard to ask: does this symbol have a C binding.

This change causes the `BIND` attribute to be set whenever there is
`BIND(C)` in the source, regardless of whether there is a name or not.
`bindName` is only set when the `BIND` attribute is also set.

Original-commit: flang-compiler/f18@5a6706ffcb
Reviewed-on: https://github.com/flang-compiler/f18/pull/298
Tree-same-pre-rewrite: false
2019-02-21 08:47:12 -08:00
peter klausler
6ed79af787 [flang] address review comments
Original-commit: flang-compiler/f18@a27f240bd4
Reviewed-on: https://github.com/flang-compiler/f18/pull/291
2019-02-19 10:08:10 -08:00
peter klausler
2793b663d6 [flang] Check for recursive EXTENDS()
Original-commit: flang-compiler/f18@8d0a9bb360
Reviewed-on: https://github.com/flang-compiler/f18/pull/291
Tree-same-pre-rewrite: false
2019-02-18 14:15:33 -08:00
peter klausler
88631be8b4 [flang] fix flang-compiler/f18#283 - recursive use of derived types
Original-commit: flang-compiler/f18@f8889b83fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/291
Tree-same-pre-rewrite: false
2019-02-18 14:15:32 -08:00
peter klausler
dd9b7fda3e [flang] Address review comments
Original-commit: flang-compiler/f18@7662121287
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
2019-02-18 13:47:34 -08:00
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
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
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
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
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
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
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
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
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
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
peter klausler
140b4adcfe [flang] Address review comments, fix some f90_correct failures
Original-commit: flang-compiler/f18@e468f8cd54
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:37 -08:00
peter klausler
1c95fef459 [flang] pass tests
Original-commit: flang-compiler/f18@db22dc2294
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:35 -08:00
peter klausler
2a88fef290 [flang] array constructor folding with test
Original-commit: flang-compiler/f18@37e7a8e666
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:34 -08:00
peter klausler
ab71bd343c [flang] folding array constructors
Original-commit: flang-compiler/f18@a4e045fc5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:33 -08:00
peter klausler
650b32ebfe [flang] support Constant arrays
Original-commit: flang-compiler/f18@a92d8a404f
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:32 -08:00
peter klausler
0ae3d43d76 [flang] Run expression semantic analysis with rest of semantics.
checkpoint array constructor semantics work

checkpoint

array constructors of lengthless intrinsic types

checkpoint

Correct ambiguous substring refs misparsed as array elements

Original-commit: flang-compiler/f18@2232549efe
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:28 -08:00
peter klausler
1e706b1136 [flang] Update fix based on comment
Original-commit: flang-compiler/f18@52dfd3b5dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/272
2019-01-30 10:31:26 -08:00
peter klausler
242407d853 [flang] Fix bugs flang-compiler/f18#269 & flang-compiler/f18#270
Original-commit: flang-compiler/f18@639816f3ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/272
Tree-same-pre-rewrite: false
2019-01-30 09:55:42 -08:00
peter klausler
74a77dd2ed [flang] Use IEEE-754 terminology better: subnormal, not denormal(ized)
Original-commit: flang-compiler/f18@57b0ebb558
Reviewed-on: https://github.com/flang-compiler/f18/pull/273
2019-01-29 16:47:41 -08:00
Jean Perier
8453e1bc13 [flang] Cleaned folding test helper template
Original-commit: flang-compiler/f18@b402c0a09c
2019-01-25 03:24:31 -08:00
Jean Perier
fd8e708108 [flang] Add test related to issue flang-compiler/f18#267
Original-commit: flang-compiler/f18@a9b2a05f75
Tree-same-pre-rewrite: false
2019-01-24 09:49:00 -08:00
Jean Perier
a60121f9f3 [flang] Fix issue flang-compiler/f18#267 (GetScalarConstantValue)
Original-commit: flang-compiler/f18@9fcbd09a51
Tree-same-pre-rewrite: false
2019-01-24 09:46:35 -08:00
Jean Perier
1131551d0a [flang] Removed unnecessary reinterpret_cast.
Original-commit: flang-compiler/f18@dd08a7fd3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
2018-11-29 13:17:53 -08:00
Jean Perier
8e76e8727b [flang] Fix: CFI_type_char is now considered Fortran CHARACTER
Original-commit: flang-compiler/f18@7c23573bd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-28 12:17:34 -08:00
Jean Perier
9b3d9e52f2 [flang] Added nullptr check in CFI functions returning error codes
Original-commit: flang-compiler/f18@5213d3a921
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-27 16:07:21 -08:00
Jean Perier
a4e942aedf [flang] Changed CFI_CDESC_T c++ macro and various other comment fixes
-  CFI_CDESC_T can now be cast to CFI_cdesc_t without using
    reinterpret_cast.
 -  Use {} initialization everywhere according to style guideline
 -  Avoid useless parentheses
 -  Do not use static storage when useless in tests.
 -  Reodered some loops that were confusing in tests

Original-commit: flang-compiler/f18@d0ed631dfd
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-27 14:13:21 -08:00
Jean Perier
2d7b243369 [flang] editorial change after review
Original-commit: flang-compiler/f18@92339ea11a
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-26 15:31:07 -08:00
Jean Perier
2b634a6f45 [flang] fix review comments
Original-commit: flang-compiler/f18@5d9ef043a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-19 09:10:08 -08:00
Jean Perier
4a4ca14cb2 [flang] Comment typos correction
Original-commit: flang-compiler/f18@107c105636
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-19 08:59:07 -08:00
Jean Perier
218a5aa56a [flang] Set lower bounds to 0 in CFI_establish, CFI_select_part and CFI_setpointer
Original-commit: flang-compiler/f18@65c67347d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-19 07:50:30 -08:00
Jean Perier
0562341063 [flang] CFI_allocate: fixed CFI_type_char/cptr
Original-commit: flang-compiler/f18@ba9274d3ee
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-16 08:00:41 -08:00
Jean Perier
cc436e74df [flang] CFI_set_pointer, CFI_section, CFI_select_part and tests
Original-commit: flang-compiler/f18@e3830c5878
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-16 07:10:04 -08:00
peter klausler
7f4fb7f89f [flang] update copyright date
Original-commit: flang-compiler/f18@c9dbc96042
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
2019-01-23 16:31:17 -08:00
peter klausler
85ea49eaba [flang] tweak CMakeLists.txt options
Original-commit: flang-compiler/f18@64ba0c0d6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:21 -08:00
peter klausler
9d63306d76 [flang] Remove SHARED from add_library(), use cmake command line option instead
Original-commit: flang-compiler/f18@6644c799a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:20 -08:00
peter klausler
f47c0bdaba [flang] Add SHARED to add_library() invocations so f18 libraries are always built shared.
Original-commit: flang-compiler/f18@060ced04c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:20 -08:00
peter klausler
db5b3fbd89 [flang] Enable building f18 as shared libraries
Original-commit: flang-compiler/f18@4544d75af1
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:19 -08:00
peter klausler
e7b93436c3 [flang] Rearrange code to eliminate dependence cycles between f18 library binaries
Original-commit: flang-compiler/f18@88651eecae
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:19 -08:00
peter klausler
f9d6c0a338 [flang] Move default intrinsic type kinds from lib/semantics to lib/common
Original-commit: flang-compiler/f18@887e72dd61
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:18 -08:00
peter klausler
cfe14d0f0b [flang] Make x86 fp behavior emulation conditional.
Original-commit: flang-compiler/f18@0c77a634b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/266
2019-01-22 11:13:44 -08:00
peter klausler
a75f28a8a2 [flang] Fix crash reported by Jean in error recovery case
Original-commit: flang-compiler/f18@33db1790be
Reviewed-on: https://github.com/flang-compiler/f18/pull/264
2019-01-18 12:09:22 -08:00
peter klausler
6d4f4b269b [flang] fix clang build warning
Original-commit: flang-compiler/f18@799fe63779
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
2019-01-18 10:45:07 -08:00
peter klausler
5ceaa14dd9 [flang] done with merge
Original-commit: flang-compiler/f18@9c63eb7a1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 16:14:36 -08:00
peter klausler
7f3590771e [flang] merge with master, implement a TODO with LEN on ASSOCIATE
Original-commit: flang-compiler/f18@e4501c6fa4
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 13:52:10 -08:00
peter klausler
be3b765e2a [flang] basic skeleton of assignment analyzer
remove needless template<> on some function overloads

dodge bogus compiler warning from gcc 8.1.0 only

stricter typing of expressions in symbols

adjust modfile12.f90 expected test results

add Unwrap, massage folding a bit

Use Unwrap to simplify folding

Move KindSelector analysis into expression semantics

fix crash

checkpoint

updates to TypeParamInquiry

support of %KIND type parameter inquiry

equality testing for expressions

checkpoint during PDT implementation

reformat

checkpoint derived type instantiation

checkpoint

resolve merge

debugging failed tests

fix failing resolve37.f90 test

all existing tests pass

clean up all build warnings

fix bug

update copyright dates

fix copyright dates

address review comments

review comment

merge with master after peeling off changes

bugfixing new feature

fix warning from old g++s

tweaks after merging with latest head

more bugfixing

making modfile17.f90 test work

Make kinds into expressions in symbol table types

big refactor for deferring kinds in intrinsic types

modfile17.f90 test passes

clean up TODOs

Simplify types as stored in scopes

Test KIND parameter default init expressions, debug them

Update copyright dates

address comments

remove dead line

address comments

Original-commit: flang-compiler/f18@1f43d0a048
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 10:41:08 -08:00
Tim Keith
42d7ac3e36 [flang] Fix link error from last integration
We need to be able to analyze the `Variable` in a `Selector` and an
expression. That worked in a previous iteration of `expression.h` by
analyzing each variant of `Variable`.

This fix adds an explicit public function to analyze a Variable and
return a `MaybeExpr`.

Original-commit: flang-compiler/f18@9848a5d48f
Reviewed-on: https://github.com/flang-compiler/f18/pull/262
2019-01-16 17:18:10 -08:00
Tim Keith
3020a18652 [flang] Fix typo
Original-commit: flang-compiler/f18@27af745986
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
2019-01-16 13:21:15 -08:00
Tim Keith
ee28b70827 [flang] Resolve names in ASSOCIATE and SELECT TYPE
Create `AssocEntityDetails` for symbols that represent entities
identified by the associate-name in ASSOCIATE and SELECT TYPE
constructs.

For ASSOCIATE, create a new scope for the associated entity.
For SELECT TYPE, create a new scope for each of type guard blocks.
Each one contains an associated entity with the appropriate type.

For SELECT TYPE, also create a place-holder symbol for the
associate-name in the SELECT TYPE statement. The real symbols
are in the new scopes and none of them is uniquely identified
with the associate-name.

Handling of `Selector` is common between these, with
`associate-name => expr | variable` recorded in
`ConstructVisitor::association_`.

When the selector is an expression, derive the type of the associated
entity from the type of the expression. This required some refactoring
of how `DeclTypeSpec`s are created. The `DerivedTypeSpec` that comes
from and expression is const so we can only create const `DeclTypeSpec`s
from it. But there were times during name resolution when we needed to
set type parameters in the current `DeclTypeSpec`. Now the non-const
`DerivedTypeSpec` is saved separately from the const `DeclTypeSpec`
while we are processing a declaration type spec. This makes it
unnecessary to save the derived type name.

Add a type alias for `common::Indirection` to reduce verbosity.

Original-commit: flang-compiler/f18@b7668cebe4
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
Tree-same-pre-rewrite: false
2019-01-15 16:59:20 -08:00
Eric Schweitz
d1c5ae55aa [flang] changes per review comments
Original-commit: flang-compiler/f18@8a3b5b5953
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
2019-01-10 12:13:45 -08:00
Eric Schweitz
349c623bba [flang] Fix typos on superscripts.
Original-commit: flang-compiler/f18@c9755c28f0
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Tree-same-pre-rewrite: false
2019-01-10 10:34:02 -08:00