Commit graph

872 commits

Author SHA1 Message Date
peter klausler
a99e9c99f3 [flang] complete new Fold
Original-commit: flang-compiler/f18@4d1726778f
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:12 -07:00
peter klausler
60c16541c2 [flang] dodge gcc 7.2.0 build hiccup
Original-commit: flang-compiler/f18@4a9e862d74
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:10 -07:00
peter klausler
f50047f45c [flang] merge with master
Original-commit: flang-compiler/f18@53f15da06a
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:10 -07:00
peter klausler
d6ea6af7c4 [flang] new refactored Fold
Original-commit: flang-compiler/f18@061868fd85
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:09 -07:00
peter klausler
43a0a63441 [flang] start refactoring of Constant and Fold
Original-commit: flang-compiler/f18@53f7174c3d
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:19:07 -07:00
peter klausler
d804c9d6bb [flang] Refactor some lib/evaluate headers for sanity
Original-commit: flang-compiler/f18@9530378c39
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:17:52 -07:00
peter klausler
84ea49d062 [flang] rearrange arguments into dummy argument order
Original-commit: flang-compiler/f18@3bab0f55de
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:16:46 -07:00
peter klausler
ef9dd9d1fe [flang] refactor a bit, and rearrange actual arguments into dummy order on intrinsic calls
Original-commit: flang-compiler/f18@1f50ace68b
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:16:41 -07:00
peter klausler
fdd3a2adca [flang] Use Attrs for intrinsic results rather than flags.
Original-commit: flang-compiler/f18@14c9199718
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:15:54 -07:00
Tim Keith
b78109e22e [flang] Address review comments
Original-commit: flang-compiler/f18@c3597a1984
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
2018-10-26 11:57:08 -07:00
Tim Keith
507121f63f [flang] Process SeparateModuleSubprogram during name resolution
When a SeparateModuleSubprogram is encountered, check that there is a
corresponding declaration in the current module/submodule or an ancestor.
When it's the current program unit, special handling is required to
avoid trying to declare it again.

Module subprograms with the `MODULE` prefix are handled similarly.
The `hasModulePrefix` flag is passed in to `BeginSubprogram` to
distinguish this case.

Extract common part of `Post(SubroutineStmt)` and `Post(FunctionStmt)` into
`PostSubprogramStmt`. Add code there to ensure that separate module
procedures do not have `EXTERNAL` set. This requires a fix to `ModFileWriter`
to correctly decide when a subprogram is declared in an interface block.

Extract `WalkSubprogramPart` into a separate function. It walks the
internal or module subprograms collecting their names. It is needed to
handle separate module subprograms.

Original-commit: flang-compiler/f18@339b65f251
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:34:50 -07:00
Tim Keith
ed23707231 [flang] Reformat and add comment
Original-commit: flang-compiler/f18@524f224adc
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:16:00 -07:00
Tim Keith
6778aa5c4f [flang] Fix failure to resolve submodule name.
If we have `SUBMODULE(m:s1) s2` and `s1` is already in memory (i.e. does
not need to be read from the `m-s1.mod` file), we still need to record
the fact that the name is a reference to that module symbol.

Original-commit: flang-compiler/f18@4bb42ed6a4
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:16:00 -07:00
Tim Keith
ac0c599920 [flang] Fix bug with popping scopes.
Processing a SUBMODULE can cause any number of scopes to be pushed on
the scope stack. We don't know how many to pop at the end, so add
`ClearScopes()` to reset the scope stack to its original state.

Original-commit: flang-compiler/f18@0be4cebd66
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
Tree-same-pre-rewrite: false
2018-10-26 07:16:00 -07:00
Jean Perier
f7e7cb349b [flang] Changed .clang-format so that it will not add a comment after the closing brace of each namespace. Removed all such previous comments from all .cc and .h files
Original-commit: flang-compiler/f18@aa7f55e15f
Reviewed-on: https://github.com/flang-compiler/f18/pull/217
2018-10-25 05:55:23 -07:00
Tim Keith
e064f4f4b9 [flang] Fix bug in rewriting function reference
`a(i)` is parsed as a function reference and needs to be converted to an
array element reference when `a` is an object entity. That determination
was wrong if the symbol for `a` was a symbol representing host-association
or use-association. In that case we need to get to the original symbol
by calling `GetUltimate()` on the symbol.

This was causing symbol09.f90 to get a compilation error because an
array element reference looked like a call to a non-pure function, which
is prohibited inside a DO CONCURRENT.

Original-commit: flang-compiler/f18@221e6c52c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/216
2018-10-24 13:39:17 -07:00
Eric Schweitz
fd93b9f3ae [flang] Fix conflicts
Fix more rotten bits
Fix the tests to reflect merges

Original-commit: flang-compiler/f18@b9a1a8b809
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
2018-10-24 12:22:42 -07:00
Eric Schweitz
da521a2284 [flang] add openmp simd test
Original-commit: flang-compiler/f18@c31bb0d144
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
f0c8e2ab38 [flang] minor changes
Move functions out of FindDoConcurrentLoops
tweak comments

Original-commit: flang-compiler/f18@713c7e8f9e
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
e644e6e8c8 [flang] add C1120, C1122 and placehokders for C1006, C1121, and C1123
add a new test for C1120
Fix new test's CHECKs
More contraints hacking

Original-commit: flang-compiler/f18@197e5fd750
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
76fc3ab928 [flang] Add OpenMP annotated loops example as a test
Original-commit: flang-compiler/f18@d0177b8cc6
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
e75f2551c1 [flang] enable the IEEE_GET_FLAG test
Original-commit: flang-compiler/f18@3f95b388a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
ad014e3ce4 [flang] More review changes
Original-commit: flang-compiler/f18@48f34e66c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
04d5058723 [flang] Global replace identifier names.
Original-commit: flang-compiler/f18@93303cd50d
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
1f0b29916d [flang] Incorperate review comments
Original-commit: flang-compiler/f18@33ff57e320
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
30c7c99d54 [flang] Add more constraint checking for DO CONCURRENT.
Add some more tests.

Original-commit: flang-compiler/f18@e65f755fe1
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
bbdfd7d4d0 [flang] add another resolve-label test for misplaced end do statement.
Original-commit: flang-compiler/f18@17fa8c1ebf
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
4c02758a80 [flang] Cleanup some cruft and tweaks per review comments.
Added a negative test, to check that semantics are not applied bogusly
to loops that are not DO CONCURRENT.

Original-commit: flang-compiler/f18@d8de45e994
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
0571c2f19e [flang] DO CONCURRENT semantic constraints checking
Add tests for DO CONCURRENT

Original-commit: flang-compiler/f18@0b40fe1ce4
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
Tree-same-pre-rewrite: false
2018-10-24 12:22:42 -07:00
Eric Schweitz
9c02ffeec6 [flang] rename sayLabel SayLabel
Original-commit: flang-compiler/f18@040af06134
Reviewed-on: https://github.com/flang-compiler/f18/pull/185
2018-10-24 11:03:49 -07:00
Eric Schweitz
0df55dace7 [flang] Tweak the error messages to not use "here" like gcc does.
Original-commit: flang-compiler/f18@cb5da3d4e4
Reviewed-on: https://github.com/flang-compiler/f18/pull/185
Tree-same-pre-rewrite: false
2018-10-24 11:03:49 -07:00
Eric Schweitz
2ced09610b [flang] Improved error messages:
Update the tests to reflect new message
Improved error messages to show both source and destination of mismatches.

Use CharBlock::size.

Original-commit: flang-compiler/f18@bf79d77d3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/185
Tree-same-pre-rewrite: false
2018-10-24 11:03:49 -07:00
Tim Keith
d3e063e648 [flang] Rename PushLocation() to SetLocation().
Original-commit: flang-compiler/f18@1b5593c12b
Reviewed-on: https://github.com/flang-compiler/f18/pull/215
2018-10-23 14:35:13 -07:00
Tim Keith
30dd289247 [flang] Add FoldingContext to SemanticsContext
FoldingContext is now part of SemanticsContext. It is created at the
beginning with a default-constructed CharBlock as the location in its
ContextualMessages.

Add PushLocation() to ContextualMessages to remember the previous source
location and set a new one. The old one is restored when the returned
object goes out of scope.

SemanticsContext is now the only state passed in to class ExprAnalyzer,
class Mutator, AnalyzeExpr(), AnalyzeExpressions().

Add Say() convenience functions for reporting errors to ExprAnalyzer.

Original-commit: flang-compiler/f18@70c499ffc4
Reviewed-on: https://github.com/flang-compiler/f18/pull/215
Tree-same-pre-rewrite: false
2018-10-22 16:41:26 -07:00
Tim Keith
16980c718a [flang] Refactoring: add SemanticsContext class
The new SemanticsContext holds the state of semantics whose lifetime
spans all of the compilations. It contains the scope tree (and so all
symbols), the intrinsics table, messages, and the state of options that
affect semantics (default kinds, search directories, etc.)

Original-commit: flang-compiler/f18@f04ceab81f
Reviewed-on: https://github.com/flang-compiler/f18/pull/215
Tree-same-pre-rewrite: false
2018-10-22 07:37:38 -07:00
Tim Keith
ed94af4c47 [flang] More name resolution for construct entities
Push a new scope for constructs and statements that require one
(DataStmt, DO CONCURRENT, ForallConstruct, ForallStmt -- there are more
to do). Currently we use the Block kind of scope because there is no
difference. Perhaps that kind should be renamed to Construct, though it
does apply to statements as well as constructs.

Add DeclareConstructEntity to create a construct or statement entity.
When the type is not specified it can come from the type of a symbol in
the enclosing scope with the same name. Change DeclareObjectEntity et al.
to return the symbol declared, for the benefit of DeclareConstructEntity.

Use DeclareConstructEntity for DO CONCURRENT index-name, LOCAL, and
LOCAL_INIT variables and the data-i-do-variable in DataImpliedDo

Names in SHARED locality spec need special handling: create a new kinds
of symbol with HostAssocDetails to represent the host-association of the
shared variables within the construct scope. That symbol gets the
LocalityShared flag without affecting the symbol in the outer scope.
HostAssoc symbols may be useful in other contexts, e.g. up-level
references to local variables.

Add parser::DoConstruct::IsDoConcurrent() because DO CONCURRENT loops
introduce a construct scope while other DO loops do not.

Move CanonicalizeDo to before name resolution so that name resolution
doesn't have to deal with labeled DO CONCURRENT loops.

Allow for type of index name to be specified in ConcurrentHeader.

Resolve the derived type name in an AllocateStmt, StructureConstructor

Original-commit: flang-compiler/f18@bc7b989136
Reviewed-on: https://github.com/flang-compiler/f18/pull/214
2018-10-18 09:06:11 -07:00
Tim Keith
b670249e9b [flang] Simplify unparse-with-symbols.cc
Change it so that the first time a symbol is referenced, its full
definition is emitted, prefixed by "DEF:", and subsequent references
are prefixed with "REF:".

This doesn't give exactly the same results as before but it is
sufficient for testing and is simpler and easier to maintain.
The expected results need to be tweaked accordingly.

Original-commit: flang-compiler/f18@27b5d082a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/214
Tree-same-pre-rewrite: false
2018-10-18 07:56:33 -07:00
peter klausler
7c402d9c50 [flang] Add -i8, -r8, &c. options to f18 development driver
Original-commit: flang-compiler/f18@ff7f338126
Reviewed-on: https://github.com/flang-compiler/f18/pull/213
2018-10-16 14:42:22 -07:00
peter klausler
76effcc5fb [flang] Eliminate DefaultInteger
Original-commit: flang-compiler/f18@1760b9ccc5
Reviewed-on: https://github.com/flang-compiler/f18/pull/213
Tree-same-pre-rewrite: false
2018-10-16 13:24:57 -07:00
peter klausler
d2f36b9d76 [flang] Eliminating old default type declarations
Original-commit: flang-compiler/f18@10e4a3385a
Reviewed-on: https://github.com/flang-compiler/f18/pull/213
Tree-same-pre-rewrite: false
2018-10-15 17:11:24 -07:00
peter klausler
bf339f8d47 [flang] Extract IntrinsicTypeDefaultKinds, move it into semantics
Original-commit: flang-compiler/f18@dd819b4727
Reviewed-on: https://github.com/flang-compiler/f18/pull/213
Tree-same-pre-rewrite: false
2018-10-15 15:28:47 -07:00
peter klausler
94041d7667 [flang] review comments
Original-commit: flang-compiler/f18@daaf080dbc
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
2018-10-15 13:39:51 -07:00
peter klausler
51b09b62c6 [flang] improve naming, silence bogus warnings
Original-commit: flang-compiler/f18@f884fcb2c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-15 12:17:30 -07:00
peter klausler
55df4a7ad8 [flang] more unit testing, fix a bug
Original-commit: flang-compiler/f18@70189119df
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:25:39 -07:00
peter klausler
7bda1b3243 [flang] unit testing, better error messages
Original-commit: flang-compiler/f18@f3876008d0
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:41 -07:00
peter klausler
62425d6021 [flang] begin unit testing
Original-commit: flang-compiler/f18@c8b691a4ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:40 -07:00
peter klausler
ad9aede8ce [flang] finish most intrinsic table entries
Original-commit: flang-compiler/f18@134bd885af
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:39 -07:00
peter klausler
24379cc0fc [flang] a few more intrinsics and some style guide comments
Original-commit: flang-compiler/f18@b6696ef923
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:37 -07:00
peter klausler
8efb8972c2 [flang] more intrinsics
Original-commit: flang-compiler/f18@2e7210be5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:36 -07:00
peter klausler
f7f2a73a43 [flang] remove arg->intValue field
Original-commit: flang-compiler/f18@721dc92022
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:35 -07:00
peter klausler
a62636f634 [flang] debug initial intrinsic table probes
Original-commit: flang-compiler/f18@dce9a1e173
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:34 -07:00
peter klausler
cb308d32a1 [flang] error messages
Original-commit: flang-compiler/f18@392a733073
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:33 -07:00
peter klausler
75a32097fd [flang] checkpoint
Original-commit: flang-compiler/f18@e103152671
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:31 -07:00
peter klausler
a70f596719 [flang] intrinsic pattern matching
Original-commit: flang-compiler/f18@ca0ee1660a
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:30 -07:00
peter klausler
b22d494357 [flang] buildable checkpoint before merging with master
Original-commit: flang-compiler/f18@78c5b8c411
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:29 -07:00
peter klausler
42b33da129 [flang] initial intrinsics table
Original-commit: flang-compiler/f18@8b5c3adf88
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
Tree-same-pre-rewrite: false
2018-10-12 16:02:28 -07:00
Tim Keith
edf9eec265 [flang] More miscellaneous name resolution
Resolve the index name in a FORALL, DO, or DO CONCURRENT.

Handle pointer-stmt. Add DeclareUnknownEntity() to declare an entity
that is not yet know to be an object or procedure. This is used in the
EntityDecl and PointerDecl cases.

When an array element assignment is mistakenly parsed as a statement
function, ensure the index names are resolved.

Detect erroneous use-association with local name that matches the name
of the containing subprogram.

Cleanup: Eliminate GetVariableName() and CheckImplicitSymbol() in favor
of using the Resolve* functions consistently. Add ResolveName() to do
what CheckImplicitSymbol() used to do.

Disable warnings about unresolved names for some categories of
constructs that are not yet implemented: common blocks, namelist
statements, etc. These will be turned back on when they are implemented.

Original-commit: flang-compiler/f18@9a41bf37fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/210
2018-10-10 16:20:46 -07:00
Tim Keith
7db04a4c05 [flang] Check conflicting construct names
Check that construct names don't conflict with other construct names or
entities in the same scoping unit.

This requires adding symbols for them. MiscDetails was added for cases
like this where we don't need to save much information about the symbol.
References to construct names are recorded too, so those names are now
expected to be resolved and no longer are exceptions in rewrite-parse-tree.cc

Checking that construct names match is still done in resolve-labels.cc.

Original-commit: flang-compiler/f18@0ad79ff029
Reviewed-on: https://github.com/flang-compiler/f18/pull/210
Tree-same-pre-rewrite: false
2018-10-10 16:05:00 -07:00
peter klausler
884d9057d0 [flang] Prep for review
Original-commit: flang-compiler/f18@a9439ee83c
Reviewed-on: https://github.com/flang-compiler/f18/pull/209
2018-10-10 15:27:17 -07:00
peter klausler
fa671ab542 [flang] Remove some obsolete casts now that Integer has a better constructor
Original-commit: flang-compiler/f18@f9a4a8bdda
Reviewed-on: https://github.com/flang-compiler/f18/pull/209
Tree-same-pre-rewrite: false
2018-10-10 15:01:12 -07:00
peter klausler
a10f6000b0 [flang] Fix issue#202 by avoiding clang+BSD/Darwin header bug
Original-commit: flang-compiler/f18@1bdefe528a
Reviewed-on: https://github.com/flang-compiler/f18/pull/209
Tree-same-pre-rewrite: false
2018-10-10 15:01:10 -07:00
Paul Henning
3712060d2e [flang] Removed obsolete comments and conversions
The addition of a more robust Integer constructor for POD types has
made some comments and static_cast expressions obsolete.

Original-commit: flang-compiler/f18@847b8a7684
Reviewed-on: https://github.com/flang-compiler/f18/pull/208
2018-10-10 14:43:21 -07:00
peter klausler
4bdb76af0b [flang] Make conversions between C++ integral types and Integer fully generic.
Original-commit: flang-compiler/f18@bf753a183d
Reviewed-on: https://github.com/flang-compiler/f18/pull/206
2018-10-10 13:21:46 -07:00
Tim Keith
03435d981d [flang] Use fundamental types in overloadings of Unparse.
Different systems map std::size_t, string::size_type, etc. to different
fundamental types. To ensure they are all covered, make the overloadings
of Unparse for integer types use only fundamental types.

This fixes compilations problems on Darwin and *BSD systems.

Original-commit: flang-compiler/f18@5576ed49a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/205
2018-10-10 07:24:27 -07:00
Eric Schweitz
ee7b4dafde [flang] Build the label stack locally and thread the iterators explicitly rather
than as implied state within the Mutator object.

Original-commit: flang-compiler/f18@ae2adeab34
Reviewed-on: https://github.com/flang-compiler/f18/pull/203
2018-10-05 13:59:43 -07:00
Eric Schweitz
98ed7d037b [flang] Use move semantics directly to move the LoopControl object.
Original-commit: flang-compiler/f18@7d646b42bb
Reviewed-on: https://github.com/flang-compiler/f18/pull/203
Tree-same-pre-rewrite: false
2018-10-05 11:10:47 -07:00
peter klausler
b64a39e1ea [flang] Prep for review
Original-commit: flang-compiler/f18@e86eae005e
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
2018-10-04 13:55:51 -07:00
peter klausler
7e87d5a297 [flang] Parse nonlabel DO within label DO better; add -fdebug-semantics; more testing
Original-commit: flang-compiler/f18@2825a45956
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
Tree-same-pre-rewrite: false
2018-10-04 13:54:07 -07:00
peter klausler
4d6885346e [flang] rework non-block DO loop canonicalization
Original-commit: flang-compiler/f18@50574936f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
Tree-same-pre-rewrite: false
2018-10-04 13:52:42 -07:00
peter klausler
2df6a9638b [flang] add test for canonicalization of DOs
Original-commit: flang-compiler/f18@aa40c6c7ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/200
Tree-same-pre-rewrite: false
2018-10-04 13:50:54 -07:00
Eric Schweitz
f5286c19b6 [flang] Add static to explicitly denote that some member functions do not access
the object's state; it is explicitly passed instead.

Original-commit: flang-compiler/f18@53df8087f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/201
2018-10-04 09:57:39 -07:00
Eric Schweitz
c06e78ae16 [flang] Fix recursion bug so canondo04.f90 test passes.
Original-commit: flang-compiler/f18@49510ff01f
Reviewed-on: https://github.com/flang-compiler/f18/pull/201
Tree-same-pre-rewrite: false
2018-10-04 09:41:29 -07:00
peter klausler
c71aecb787 [flang] Correct the spelling of LOCAL_INIT clauses on DO CONCURRENT statements.
Original-commit: flang-compiler/f18@bfc869ad5f
Reviewed-on: https://github.com/flang-compiler/f18/pull/198
2018-10-02 10:03:37 -07:00
Eric Schweitz
c105c9432a [flang] Review comments
Original-commit: flang-compiler/f18@fa5daf35ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/199
2018-10-02 09:29:53 -07:00
peter klausler
7b141b62df [flang] Resolve g++ 7.2 build problem
Original-commit: flang-compiler/f18@09859b2e9c
Reviewed-on: https://github.com/flang-compiler/f18/pull/197
2018-10-01 14:36:31 -07:00
Eric Schweitz
1c2dc51cc0 [flang] Handle review comments
Original-commit: flang-compiler/f18@9789d4d21b
Reviewed-on: https://github.com/flang-compiler/f18/pull/193
2018-09-21 11:12:02 -07:00
Eric Schweitz
d14c38fbe7 [flang] Rename two member functions
Original-commit: flang-compiler/f18@c953185c9f
Reviewed-on: https://github.com/flang-compiler/f18/pull/193
Tree-same-pre-rewrite: false
2018-09-21 10:51:06 -07:00
Eric Schweitz
8b45686de6 [flang] Fix the double end do condition. Translate a labelled end do into a
continue and preserve the label for control flow.

Original-commit: flang-compiler/f18@bd611b9809
Reviewed-on: https://github.com/flang-compiler/f18/pull/193
Tree-same-pre-rewrite: false
2018-09-21 08:22:41 -07:00
Eric Schweitz
4972485598 [flang] canonicalize DO constructs
Fix a bug with BLOCK DATA name matching
Add tests and finish up DO loop canonicalization

Original-commit: flang-compiler/f18@2d93b2819c
Reviewed-on: https://github.com/flang-compiler/f18/pull/193
Tree-same-pre-rewrite: false
2018-09-20 16:14:58 -07:00
peter klausler
42d17f21eb [flang] More documentation
Original-commit: flang-compiler/f18@7fd40e8598
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
2018-09-26 12:58:43 -07:00
peter klausler
bab1f67b5f [flang] Improve documentation per review comments.
Original-commit: flang-compiler/f18@5a8bbbe511
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-26 10:42:55 -07:00
peter klausler
370c44ad76 [flang] tweaks to intrinsics.md
Original-commit: flang-compiler/f18@ad44f28825
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 16:59:41 -07:00
peter klausler
970e746c2e [flang] review
Original-commit: flang-compiler/f18@d7bb34ae2b
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:36:00 -07:00
peter klausler
e7c5a470bd [flang] polish documentation of intrinsics
Original-commit: flang-compiler/f18@9f9424c996
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:06 -07:00
peter klausler
9849cf5844 [flang] documentation
Original-commit: flang-compiler/f18@452760d706
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:05 -07:00
peter klausler
3cecff6a05 [flang] checkpoint
Original-commit: flang-compiler/f18@960ae495fd
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:04 -07:00
peter klausler
d969464673 [flang] typed function references
Original-commit: flang-compiler/f18@e9b9d72958
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:04 -07:00
peter klausler
ad2fda8932 [flang] substrings and better rank checks
Original-commit: flang-compiler/f18@4fa483ac49
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:02 -07:00
peter klausler
0787d7f2df [flang] check C1002
Original-commit: flang-compiler/f18@6a2fd760b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:02 -07:00
peter klausler
1322e6090f [flang] Use dynamic default REAL kind for conversions that were static
Original-commit: flang-compiler/f18@9a83fbbe95
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:01 -07:00
peter klausler
a5687fd579 [flang] source provenances for expressions
Original-commit: flang-compiler/f18@5fe292fcac
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:00 -07:00
peter klausler
b74d469103 [flang] some clean-up
Original-commit: flang-compiler/f18@b6eb3e990a
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:24:00 -07:00
peter klausler
c2d4f07cda [flang] Changes that might fix MSVC build problems from sjs
Original-commit: flang-compiler/f18@009f0cc8df
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:23:59 -07:00
peter klausler
84af9c28f0 [flang] subscripts
Original-commit: flang-compiler/f18@7fb7518af7
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:23:59 -07:00
peter klausler
93a7f1f85c [flang] work on structure components
Original-commit: flang-compiler/f18@619b6957b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/195
Tree-same-pre-rewrite: false
2018-09-25 15:23:58 -07:00
Tim Keith
9f29b0152a [flang] Simplify handling of ProcDecl
DeclareProcEntity takes care of setting the Function or Subroutine flag
on the procedure entity, so it is not necessary in this function.

Original-commit: flang-compiler/f18@a015b3187d
Reviewed-on: https://github.com/flang-compiler/f18/pull/194
2018-09-24 11:43:48 -07:00
Tim Keith
a0858885c2 [flang] Recognize complex-part-designator
The "%RE" or "%IM" is parsed as a structure-component.
If the base has type COMPLEX and the component name is one
of those, allow it without comment.

Note that the `parser::Name` for these components don't get
symbols filled in, so we still get a warning that they are
unresolved. We have to figure out how to deal with names
like this that we won't have symbols for.

Fixes flang-compiler/f18#188.

Original-commit: flang-compiler/f18@1d4a84fe3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/194
Tree-same-pre-rewrite: false
2018-09-24 07:12:38 -07:00
Tim Keith
9811353abf [flang] Fix problems determining object/function/subroutine
Convert each Entity to ObjectEntity at the end of each scope.
Add `ConvertToObjectEntity()` to achieve this, similar to
`ConvertToProcEntity()`. Move them both up into `ScopeHandler`
because they need to be called from `PopScope()`.

In a proc-decl, only mark the proc as a function if it has a return type.
If no return type is declared, function vs. subroutine is determined by:
- for a module it is a subroutine (at end of specification-part)
- otherwise it is by usage

If an entity that could otherwise be a function is used as the base of a
structure component, that forces it to be an object. Because we have to
change it to an object entity at that point, the `base` in `FindComponent()`
can't be const, and that propagates to all of its callers.

Remove the name argument to `ApplyImplicitRules` as it is unneeded.

Fixes flang-compiler/f18#191.

Original-commit: flang-compiler/f18@9bd8bf7c37
Reviewed-on: https://github.com/flang-compiler/f18/pull/194
Tree-same-pre-rewrite: false
2018-09-22 08:05:46 -07:00
Tim Keith
af22eea4b0 [flang] Fix typo
Original-commit: flang-compiler/f18@3ad7a77898
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
2018-09-20 14:21:04 -07:00
Tim Keith
3133c9e7e2 [flang] Fix problems with extended derived types
When looking for a component name in a derived type, also look in the
parent type. Before adding a component to a derived type, report an
error if it already has one with that name. Check that components are
accessible when they are accessed.

Add the "parent component" to derived types (i.e. a component with the
same name as the parent type). The symbol is marked with the
`ParentComp` flag so we can avoid writing it to `.mod` files.

Add calls to `add_occurrence()` so that those particular instances of
`parser::Name` get their symbol set.

Change `DeclareObjectEntity` and `DeclareProcEntity` to use `SourceName` as
the name passed in rather than `parser::Name`.

Fix some problems in `unparse-with-symbols.cc` on statements that both
define and reference names.

Fixes flang-compiler/f18#187.

Original-commit: flang-compiler/f18@664b9627f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/192
Tree-same-pre-rewrite: false
2018-09-20 14:08:59 -07:00