Commit graph

1314 commits

Author SHA1 Message Date
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
Eric Schweitz
74eaa59e19 [flang] Merge pull request flang-compiler/f18#296 from flang-compiler/ir4
Fortran IR: part 4. Dotty graph visualization and other miscellaneous

Original-commit: flang-compiler/f18@6277e67c27
Reviewed-on: https://github.com/flang-compiler/f18/pull/296
2019-02-28 08:52:37 -08:00
Eric Schweitz
0045dc9e66 [flang] address review comments
Original-commit: flang-compiler/f18@d1a213ae55
Reviewed-on: https://github.com/flang-compiler/f18/pull/296
2019-02-22 15:48:45 -08:00
Eric Schweitz
38e5faf4e7 [flang] address review comments from part 4
Original-commit: flang-compiler/f18@64408ede56
Reviewed-on: https://github.com/flang-compiler/f18/pull/296
Tree-same-pre-rewrite: false
2019-02-21 12:51:54 -08:00
Eric Schweitz
96f7b6c808 [flang] Fortran IR: part 4. Dotty graph visualization and other miscellaneous
headers.

Original-commit: flang-compiler/f18@d7d9515f20
Reviewed-on: https://github.com/flang-compiler/f18/pull/296
Tree-same-pre-rewrite: false
2019-02-20 13:07:49 -08:00
Eric Schweitz
87d8ee9c80 [flang] Merge pull request flang-compiler/f18#295 from flang-compiler/ir3
Fortran IR: part 3, the FIR builder.  This is a factory class for

Original-commit: flang-compiler/f18@3e0cb83f03
Reviewed-on: https://github.com/flang-compiler/f18/pull/295
2019-02-28 08:36:31 -08:00
Eric Schweitz
2169307cd8 [flang] address review comments
Original-commit: flang-compiler/f18@4dd4766f4d
Reviewed-on: https://github.com/flang-compiler/f18/pull/295
2019-02-22 15:43:03 -08:00
Eric Schweitz
79a264856c [flang] respond to review comments for part 3
Original-commit: flang-compiler/f18@bcf0a6fa20
Reviewed-on: https://github.com/flang-compiler/f18/pull/295
Tree-same-pre-rewrite: false
2019-02-21 12:05:26 -08:00
Eric Schweitz
b7d98c2c22 [flang] Fortran IR: part 3, the FIR builder. This is a factory class for
helping to build a FIR representation.

Original-commit: flang-compiler/f18@9d937065ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/295
Tree-same-pre-rewrite: false
2019-02-20 12:18:04 -08:00
Peter Klausler
9fcff84f83 [flang] Merge pull request flang-compiler/f18#304 from flang-compiler/pmk-proc-interface
Procedure(id) semantics

Original-commit: flang-compiler/f18@1915126444
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
2019-02-27 13:14:18 -08:00
peter klausler
204a50d283 [flang] unparse interfaces as PROCEDURE(TYPE(REAL)) to avoid ambiguity
Original-commit: flang-compiler/f18@efef1f1ad1
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
2019-02-27 12:30:57 -08:00
peter klausler
94baaab8a8 [flang] address review comments
Original-commit: flang-compiler/f18@6f4af0fc1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-27 11:12:16 -08:00
peter klausler
92b0c8412c [flang] prep for review
Original-commit: flang-compiler/f18@794e6a42ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:22:43 -08:00
peter klausler
e6067aea50 [flang] rebasing
Original-commit: flang-compiler/f18@ff6c0be908
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:21:29 -08:00
peter klausler
4eccba942e [flang] Clean up DynamicType, link it to symbol table character length
Original-commit: flang-compiler/f18@833f5f52e2
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:21:28 -08:00
peter klausler
f953583dea [flang] checkpoint
Original-commit: flang-compiler/f18@4d907e3184
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:21:26 -08:00
peter klausler
ba56b913a4 [flang] checkpoint
Original-commit: flang-compiler/f18@e7b0f456c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:19:36 -08:00
peter klausler
2d76abcd07 [flang] checkpoint
Original-commit: flang-compiler/f18@a2b1c94ddb
Reviewed-on: https://github.com/flang-compiler/f18/pull/304
Tree-same-pre-rewrite: false
2019-02-26 16:18:56 -08:00
psteinfeld
00634a5fab [flang] Merge pull request flang-compiler/f18#301 from flang-compiler/psteinfeld
Cleanup of the documentation directory

Original-commit: flang-compiler/f18@d9cd68e078
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
2019-02-26 13:56:05 -08:00
psteinfeld
2d35239719 [flang] Update ControlFlowGraph.md
Original-commit: flang-compiler/f18@50ce01185f
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
2019-02-25 10:47:17 -08:00
psteinfeld
222f4aa048 [flang] Update C++style.md
Original-commit: flang-compiler/f18@85215c871b
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 10:45:08 -08:00
psteinfeld
b83f451e96 [flang] Update Overview.md
Original-commit: flang-compiler/f18@9a26677adc
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 10:38:55 -08:00
psteinfeld
7a274ba082 [flang] Rename Mod-files.md to ModFiles.md
Original-commit: flang-compiler/f18@587a376f24
Reviewed-on: https://github.com/flang-compiler/f18/pull/301
Tree-same-pre-rewrite: false
2019-02-25 10:27:50 -08:00
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