Commit graph

983 commits

Author SHA1 Message Date
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 f1d20a35ec [flang] Merge pull request flang-compiler/f18#218 from flang-compiler/tsk2
More name resolution for submodules

Original-commit: flang-compiler/f18@f574667aaa
Reviewed-on: https://github.com/flang-compiler/f18/pull/218
2018-10-26 11:58:13 -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
jeanPerier 4687189913 [flang] Merge pull request flang-compiler/f18#217 from flang-compiler/namespace-comment-removal
Format Style Change: Removed namespace comments after closing brace

Original-commit: flang-compiler/f18@dcca71aae2
Reviewed-on: https://github.com/flang-compiler/f18/pull/217
2018-10-26 11:18:57 +02: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 9077dc289b [flang] Merge pull request flang-compiler/f18#216 from flang-compiler/tsk4
Fix bug in rewriting function reference

Original-commit: flang-compiler/f18@22f25eadc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/216
2018-10-25 11:44:37 -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 c873638052 [flang] Merge pull request flang-compiler/f18#196 from flang-compiler/eas6
DO CONCURRENT semantic constraints checking

Original-commit: flang-compiler/f18@304c6f6548
Reviewed-on: https://github.com/flang-compiler/f18/pull/196
2018-10-24 12:22:42 -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 8712a69b8e [flang] Merge pull request flang-compiler/f18#185 from flang-compiler/eas5
Improved error messages:

Original-commit: flang-compiler/f18@f11ceaa7c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/185
2018-10-24 11:03:49 -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 9f4d92c690 [flang] Merge pull request flang-compiler/f18#215 from flang-compiler/tsk2
Refactoring: add SemanticsContext class

Original-commit: flang-compiler/f18@99b6ac0ddc
Reviewed-on: https://github.com/flang-compiler/f18/pull/215
2018-10-23 14:35:57 -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 0e7bf241a9 [flang] Merge pull request flang-compiler/f18#214 from flang-compiler/tsk2
More name resolution for construct entities

Original-commit: flang-compiler/f18@848b067be8
Reviewed-on: https://github.com/flang-compiler/f18/pull/214
2018-10-18 11:07:47 -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 dc1b56d719 [flang] Merge pull request flang-compiler/f18#213 from flang-compiler/pmk1
Fully parameterize default kinds of intrinsic types

Original-commit: flang-compiler/f18@f9da6f129a
Reviewed-on: https://github.com/flang-compiler/f18/pull/213
2018-10-16 15:31:55 -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 afd3d6bc50 [flang] Merge pull request flang-compiler/f18#212 from flang-compiler/pmk0
Intrinsic function tables

Original-commit: flang-compiler/f18@795f790e93
Reviewed-on: https://github.com/flang-compiler/f18/pull/212
2018-10-15 14:09:41 -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