Commit graph

1337 commits

Author SHA1 Message Date
peter klausler
97038db10e [flang] Dodge bogus G++ 8.1.0 build warning
Original-commit: flang-compiler/f18@582c6d1eca
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 17:02:48 -08:00
peter klausler
da2ebb6063 [flang] Improve error messages
Original-commit: flang-compiler/f18@4046134512
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:25 -08:00
peter klausler
6acfa11fda [flang] Add lib/semantics/tools.{h,cc}
Original-commit: flang-compiler/f18@c9823da207
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:25 -08:00
peter klausler
8a57433273 [flang] C1594 constraint checking on pointer components in struct constructors
Original-commit: flang-compiler/f18@386cd8a9b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:24 -08:00
peter klausler
ec8e8b8277 [flang] Length conversions in array constructors, and fix their formatting
Original-commit: flang-compiler/f18@88cdb49f48
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:24 -08:00
peter klausler
69352908e0 [flang] Character length conversion on structure constructor component assignments
Original-commit: flang-compiler/f18@051c1dd923
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:24 -08:00
peter klausler
3edc423bf8 [flang] Add SetLength operator to make character length changes explicit
Original-commit: flang-compiler/f18@f2d751d8a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:23 -08:00
peter klausler
431b84880a [flang] snapshot of work in progress
Original-commit: flang-compiler/f18@56e83d4dd6
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:23 -08:00
peter klausler
402cc8c4e9 [flang] Represent NULL()
Original-commit: flang-compiler/f18@2c3368fb5f
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:23 -08:00
peter klausler
857da8cfe9 [flang] Type checking on values in structure components
Original-commit: flang-compiler/f18@bea98aeb96
Reviewed-on: https://github.com/flang-compiler/f18/pull/311
Tree-same-pre-rewrite: false
2019-03-04 16:30:22 -08:00
Peter Klausler
8ec3d1a678 [flang] Merge pull request flang-compiler/f18#314 from flang-compiler/pmk-indirection
Add `ForwardReference<>` class template

Original-commit: flang-compiler/f18@b541a4d167
Reviewed-on: https://github.com/flang-compiler/f18/pull/314
2019-03-04 16:29:48 -08:00
peter klausler
c7cfc3f357 [flang] Add ForwardReference<> + documentation + clean-up
Original-commit: flang-compiler/f18@09e9501951
Reviewed-on: https://github.com/flang-compiler/f18/pull/314
2019-03-04 15:15:08 -08:00
peter klausler
752721d3a8 [flang] checkpoint
Original-commit: flang-compiler/f18@65abebd838
Reviewed-on: https://github.com/flang-compiler/f18/pull/314
Tree-same-pre-rewrite: false
2019-03-04 13:49:41 -08:00
Peter Klausler
5a46da7201 [flang] Merge pull request flang-compiler/f18#313 from flang-compiler/pmk-fix312
Fix flang-compiler/f18#312

Original-commit: flang-compiler/f18@74a9426adf
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
2019-03-04 13:46:24 -08:00
peter klausler
3f8e388860 [flang] Fix a typo in documentation
Original-commit: flang-compiler/f18@3248ec1cf9
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
2019-03-04 13:44:59 -08:00
peter klausler
b8db689ffe [flang] Fix accidentally modified comment
Original-commit: flang-compiler/f18@7d0b365a6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
Tree-same-pre-rewrite: false
2019-03-04 13:44:04 -08:00
peter klausler
b67a04c0bb [flang] check out with all versions
Original-commit: flang-compiler/f18@0b1369ce55
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
Tree-same-pre-rewrite: false
2019-03-04 11:55:10 -08:00
peter klausler
5c4faecc0d [flang] Fix flang-compiler/f18#312
Original-commit: flang-compiler/f18@625ffb4f1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/313
Tree-same-pre-rewrite: false
2019-03-04 11:23:50 -08:00
psteinfeld
00c7a7f423 [flang] Merge pull request flang-compiler/f18#310 from flang-compiler/psteinfeld
Fixed reference to a header file

Original-commit: flang-compiler/f18@658bc758d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/310
2019-03-01 11:06:20 -08:00
Peter Steinfeld
ff665b3938 [flang] Fixed reference to a header file
Original-commit: flang-compiler/f18@22f93f0b30
Reviewed-on: https://github.com/flang-compiler/f18/pull/310
2019-03-01 10:28:17 -08:00
Peter Klausler
b4145a1778 [flang] Merge pull request flang-compiler/f18#308 from flang-compiler/pmk-cleanups
Rename to Fortran.h, update style guide, run clang-format on everything

Original-commit: flang-compiler/f18@0cf07c3ace
Reviewed-on: https://github.com/flang-compiler/f18/pull/308
2019-02-28 12:04:50 -08:00
peter klausler
27931e47d1 [flang] Missed a fortran.h instance
Original-commit: flang-compiler/f18@3a9a185383
Reviewed-on: https://github.com/flang-compiler/f18/pull/308
2019-02-28 11:48:16 -08:00
peter klausler
ab74d1ac0c [flang] Rename to Fortran.h, update style guide, run clang-format
Original-commit: flang-compiler/f18@aa2907d226
Reviewed-on: https://github.com/flang-compiler/f18/pull/308
Tree-same-pre-rewrite: false
2019-02-28 11:48:15 -08:00
Tim Keith
94c6b215f0 [flang] Merge pull request flang-compiler/f18#309 from flang-compiler/tsk2c
Fix bug in test_modfile.sh

Original-commit: flang-compiler/f18@6e95724f0e
Reviewed-on: https://github.com/flang-compiler/f18/pull/309
2019-02-28 11:06:32 -08:00
Tim Keith
ef5499fd74 [flang] Fix bug in test_modfile.sh
The expected mod files specified in the test do not necessarily
appear in sorted order, and the desired order depends on what the
`comm` command expects. So sort them to be sure it is right.

Original-commit: flang-compiler/f18@730d0d0562
Reviewed-on: https://github.com/flang-compiler/f18/pull/309
2019-02-28 11:05:49 -08:00
Tim Keith
6d4ab830be [flang] Merge pull request flang-compiler/f18#305 from flang-compiler/tsk2
Various name resolution bug fixes

Original-commit: flang-compiler/f18@fc831f600e
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
2019-02-28 10:38:17 -08:00
Tim Keith
fe588aff56 [flang] Fix bug handling function prefix type
This showed up in procinterface01. A function can have more than one
PrefixSpec (e.g. `real elemental f()`). We need to ignore that ones
that aren't types.

Also, process the type after the ImplicitPart rather than after the
SpecificationPart. The type of the function result variable could
be accessed between those places.

Original-commit: flang-compiler/f18@df85eedb92
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
2019-02-28 10:38:17 -08:00
Tim Keith
ebcfd01ae3 [flang] Fix bug with host-association in module procedure interface body
A module procedure interface body can access entities in its host
without an IMPORT statement. So the `ImportKind` of the scope created
for such an interface body should be `Default`, not `None` as it is
for other interface bodies.

Original-commit: flang-compiler/f18@24bb2668fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Tim Keith
0b9621b635 [flang] Allow module procedure and generic with same name
The `GenericDetails::CheckSpecific()` check was happening too early.
We have to wait until all procedures of the generic have been seen.
The generic can have the same name as a module procedure only if that
module procedure is a specific procedure of the generic.

Improve the `SayAlreadyDeclared` error message when the previous
declaration is a use-association

Original-commit: flang-compiler/f18@269e3db602
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Tim Keith
563e65ded1 [flang] Fix .mod file for symbols with same name as generic
When a generic has the same name as a module procedure or derived type,
the latter weren't being written to the `.mod` file. Fix that by calling
`PutSymbol()` on those symbols from the generic. Change `PutSymbol()` to
accept `Symbol *` to make that more convenient.

Original-commit: flang-compiler/f18@1778efe981
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Tim Keith
9a497ddbad [flang] Fix resolution of function prefix type
When a function-stmt has a type in the prefix (`type(t) function f()`),
the type cannot be resolve until after processing the USE and IMPLICIT
statements. So save the parse-tree of the type and process it at the
end of the specification section.

Add `ProcessTypeSpec()` to handle the process of setting up to walk
a type spec, walking it, restoring the state, and returning the type
spec. We do this several other places too.

Original-commit: flang-compiler/f18@bcde294d0e
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Tim Keith
1ec4ec88bf [flang] Fix bug determining type of statement entity
A statement entity (`data-i-do-variable` or `ac-do-variable`) that
doesn't have a type specified gets the type it would have in the
enclosing scope. That means if there is a visible variable with the
same name, the statement entity gets its type. We were failing to
do that and just applying the implicit rules.

Original-commit: flang-compiler/f18@72bc7c29ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Tim Keith
f1bcb92180 [flang] Handle subprogram declaration after call
If an external subprogram is called and then declared, we have to
replace the `ProcEntityDetails` with `SubprogramDetails` in the symbol.
While doing so we can also check that the call was consistent with the
declaration for function vs. subprogram.

Original-commit: flang-compiler/f18@e43a2dae79
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Tim Keith
41e5053ee6 [flang] Fix bug determining function vs. subroutine
We were setting `expectedProcFlag_` to indicate if a `ProcedureDesignator`
was used in a function or subroutine context. That didn't work if they
were nested, for example: `call f(g())`.

Instead, at the point we know function vs. subroutine (i.e. in the
`CallStmt` and `FunctionReference` nodes), explicitly walk the children,
passing in the flag.

Original-commit: flang-compiler/f18@8a13283f98
Reviewed-on: https://github.com/flang-compiler/f18/pull/305
Tree-same-pre-rewrite: false
2019-02-28 10:38:17 -08:00
Peter Klausler
b1cfd23d6b [flang] Merge pull request flang-compiler/f18#307 from flang-compiler/pmk-fixes
fix flang-compiler/f18#303, better error recovery for misplaced type parameter declarat…

Original-commit: flang-compiler/f18@79684ed2eb
Reviewed-on: https://github.com/flang-compiler/f18/pull/307
2019-02-28 09:48:50 -08:00
peter klausler
6a56782b2f [flang] fix flang-compiler/f18#303, better error recovery for misplaced type parameter declarations
Original-commit: flang-compiler/f18@ebaa23cbcd
Reviewed-on: https://github.com/flang-compiler/f18/pull/307
2019-02-28 09:31:16 -08:00
Peter Klausler
5eebcae794 [flang] Merge pull request flang-compiler/f18#306 from flang-compiler/pmk-documentation
Small edits to C++17 usage notes

Original-commit: flang-compiler/f18@0e51862dd2
Reviewed-on: https://github.com/flang-compiler/f18/pull/306
2019-02-28 09:30:27 -08:00
peter klausler
9c45b0d369 [flang] Small edits to C++17 usage notes
Original-commit: flang-compiler/f18@bdf62ac900
Reviewed-on: https://github.com/flang-compiler/f18/pull/306
2019-02-28 09:29:40 -08:00
Eric Schweitz
340ecc8765 [flang] Merge pull request flang-compiler/f18#294 from flang-compiler/ir2
Fortran IR: part 2, lowest layer of the IR hierarchy. Specifically, Basic Blocks

Original-commit: flang-compiler/f18@5bae949174
Reviewed-on: https://github.com/flang-compiler/f18/pull/294
2019-02-28 09:15:05 -08:00
Eric Schweitz
e913651945 [flang] address review comments
Original-commit: flang-compiler/f18@b1c731b026
Reviewed-on: https://github.com/flang-compiler/f18/pull/294
2019-02-22 15:38:57 -08:00
Eric Schweitz
b260ca30f9 [flang] respond to review comments - part 2
Original-commit: flang-compiler/f18@5e4ed6a312
Reviewed-on: https://github.com/flang-compiler/f18/pull/294
Tree-same-pre-rewrite: false
2019-02-21 11:58:59 -08:00
Eric Schweitz
467bad4bdb [flang] Fortran IR: lowest layer of the IR hierarchy. Specifically, Basic Blocks
contain Statements.  This layer is still evolving as the IR takes better
shape and other code in the compiler is written.

Original-commit: flang-compiler/f18@e1a282296b
Reviewed-on: https://github.com/flang-compiler/f18/pull/294
Tree-same-pre-rewrite: false
2019-02-20 12:12:17 -08:00
Eric Schweitz
9a03b46d6d [flang] Merge pull request flang-compiler/f18#293 from flang-compiler/ir1
Fortran IR: part 1. staged pull request for the "upper layers" of the IR.  The

Original-commit: flang-compiler/f18@f978be5b8e
Reviewed-on: https://github.com/flang-compiler/f18/pull/293
2019-02-28 09:14:41 -08:00
Eric Schweitz
f7f819c97b [flang] code review comments
Original-commit: flang-compiler/f18@ef9bfa4bd7
Reviewed-on: https://github.com/flang-compiler/f18/pull/293
2019-02-22 15:17:57 -08:00
Eric Schweitz
8291af8963 [flang] Address review comments on part 1
Original-commit: flang-compiler/f18@854e9836c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/293
Tree-same-pre-rewrite: false
2019-02-21 11:49:51 -08:00
Eric Schweitz
52d7de892e [flang] Fortran IR: staged pull request for the "upper layers" of the IR. The
Fortran IR is hierarchical: A Program contains Procedures.  Procedures
contain Basic Blocks. Groups of Basic Blocks can be grouped as Regions.
This structure follows those one finds in SIL and LLVM IR, etc.

Original-commit: flang-compiler/f18@e2291016df
Reviewed-on: https://github.com/flang-compiler/f18/pull/293
Tree-same-pre-rewrite: false
2019-02-20 11:46:41 -08:00
Eric Schweitz
f425c4064d [flang] Merge pull request flang-compiler/f18#297 from flang-compiler/ir5
Fotran IR: part 5. Afforestation is the lowering of concrete parse trees

Original-commit: flang-compiler/f18@20da0d93e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/297
2019-02-28 08:57:09 -08:00
Eric Schweitz
bd22bbb567 [flang] changes per review comments
Original-commit: flang-compiler/f18@3868f0c934
Reviewed-on: https://github.com/flang-compiler/f18/pull/297
2019-02-22 15:51:44 -08:00
Eric Schweitz
7f1b257252 [flang] address code review for part 5
Original-commit: flang-compiler/f18@43aa508460
Reviewed-on: https://github.com/flang-compiler/f18/pull/297
Tree-same-pre-rewrite: false
2019-02-21 13:13:16 -08:00
Eric Schweitz
222e82c0fe [flang] Fotran IR: part 5. Afforestation is the lowering of concrete parse trees
and semantics information into the Fortran IR.

Original-commit: flang-compiler/f18@d1dde12640
Reviewed-on: https://github.com/flang-compiler/f18/pull/297
Tree-same-pre-rewrite: false
2019-02-20 13:10:38 -08:00