Commit graph

862 commits

Author SHA1 Message Date
Tim Keith b6db93447a [flang] Merge pull request flang-compiler/f18#169 from flang-compiler/tsk1
Add support for BLOCK construct

Original-commit: flang-compiler/f18@e9abdbc993
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
2018-08-28 11:50:45 -07:00
Tim Keith 7f9106a816 [flang] Improve comments on class ImplicitRules
Original-commit: flang-compiler/f18@926dc2bed1
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
2018-08-27 13:32:10 -07:00
Tim Keith 348921b40e [flang] Remove unused variable
Original-commit: flang-compiler/f18@05dc053442
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false
2018-08-27 12:12:03 -07:00
Tim Keith 13e9617ea2 [flang] Add support for BLOCK construct
A `BLOCK` statement opens a new scope. It is different from other scopes
in that implicitly typed entities are defined in the enclosing non-block
scope, not immediately in the block. This means that `IMPORT` statements
can cause them to be hidden.

Check that blocks can't have `IMPLICIT` statements in them. It is simpler
for the parser not to deal with the different between a
specification-part and a block-specification-part.

Change `ImplicitRules` to have a parent that is consulted when there isn't
an answer in the current one. For an interface body that does not happen
but for all other nested scopes it does. This parent link eliminates the
need for the `implicitRules_` stack. Make `isImplicitNoneType_` and
`isImplicitNoneExternal_` optional: not set means look in parent.
Fixes flang-compiler/f18#71.

Remove `CurrNonTypeScope()` and put the logic in `Symbol::FindSymbol`.

Original-commit: flang-compiler/f18@a153a2ee33
Reviewed-on: https://github.com/flang-compiler/f18/pull/169
Tree-same-pre-rewrite: false
2018-08-27 11:48:49 -07:00
Eric Schweitz 0abba67179 [flang] Merge pull request flang-compiler/f18#171 from flang-compiler/easdd2
Design document for label resolution pass

Original-commit: flang-compiler/f18@3e97e7922e
Reviewed-on: https://github.com/flang-compiler/f18/pull/171
2018-08-28 10:44:20 -07:00
Eric Schweitz a4331e23ac [flang] Add the detailed design for label resolution
Original-commit: flang-compiler/f18@89c4b70b55
Reviewed-on: https://github.com/flang-compiler/f18/pull/171
2018-08-28 10:17:38 -07:00
Tim Keith 298dbe57ee [flang] Merge pull request flang-compiler/f18#167 from flang-compiler/tsk1
Implement host association and import statements

Original-commit: flang-compiler/f18@354a594b0b
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
2018-08-23 11:59:34 -07:00
Tim Keith 37476ee32e [flang] Add common::ImportKind
Replace parser::ImportStmt::Kind and semantics::Scope::ImportKind with a
single enum class in common/fortran.h. This eliminates the need to map
between the parser enum and the semantics enum.

Original-commit: flang-compiler/f18@779a99314c
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
2018-08-23 11:45:49 -07:00
Tim Keith 364aed2109 [flang] Address review comments
Original-commit: flang-compiler/f18@c30cbc8158
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-23 11:24:12 -07:00
Tim Keith d82ec6eb23 [flang] Add another host-associate test
Verify that a derived type component does not hide a type of the same
name in its host.

Original-commit: flang-compiler/f18@212d84cb2f
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-23 07:41:06 -07:00
Tim Keith 3fc79bbc96 [flang] Code cleanup
`CurrScope()` is now a simple accessor with no logic, so rename to `currScope()`.

`PushScope()` doesn't need to return a `Scope&` and the other functions
with that name do not, so make it consistent.

Original-commit: flang-compiler/f18@c8c341be14
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-22 16:56:57 -07:00
Tim Keith 7cfad97f23 [flang] Add missing copyrights.
Original-commit: flang-compiler/f18@a9346a588a
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-22 16:05:53 -07:00
Tim Keith 5b39e7da10 [flang] Implement host association and import statements
Host association is done by search for symbols using `Scope::FindSymbol()`
which looks for the the name in the parent scope if the import rules
permit it.

Import statements are implemented using `importKind_` and `importNames_`
in class `Scope`. Most of the constraints are checked when the
`ImportStmt` is encountered. `CheckImports()` is called at the end of
the `SpecificationPart` to verify the names mentioned in the IMPORT
statement. That has to happen then so that we can detect if an imported
name is hidden by a declaration in the current scope.

Original-commit: flang-compiler/f18@0d50c8a8ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-22 16:05:06 -07:00
Tim Keith 44937f6321 [flang] Replace scope stack with current scope
We don't need to manage a stack of scopes: each scope has a reference to
its parent, so popping the scope stack is equivalent to setting the
new current scope to the parent of the old current scope.

Original-commit: flang-compiler/f18@022aa7a7f9
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-09 17:12:31 -07:00
Tim Keith 4cd3eb3c4a [flang] Collect names of internal subprograms of a MainProgram
... as is done for other internal subprograms.

Original-commit: flang-compiler/f18@079f45d51b
Reviewed-on: https://github.com/flang-compiler/f18/pull/167
Tree-same-pre-rewrite: false
2018-08-09 15:25:45 -07:00
Peter Klausler 08f0877760 [flang] Merge pull request flang-compiler/f18#166 from flang-compiler/pmk1
fix sloppy merge (sorry)

Original-commit: flang-compiler/f18@c3957893cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/166
2018-08-09 14:16:02 -07:00
peter klausler c2f56d0fb4 [flang] fix sloppy merge (sorry)
Original-commit: flang-compiler/f18@b475721e09
Reviewed-on: https://github.com/flang-compiler/f18/pull/166
2018-08-09 13:09:33 -07:00
Peter Klausler d86a81343c [flang] Merge pull request flang-compiler/f18#165 from flang-compiler/pmk0
Expression analysis and message clean-up

Original-commit: flang-compiler/f18@9fa1c429f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
2018-08-09 12:50:15 -07:00
peter klausler 27753b8b98 [flang] Canonicalize nonstandard BOZ literals to avoid spurious parse/unparse/reparse/unparse failures.
Original-commit: flang-compiler/f18@d651990632
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
2018-08-09 10:17:44 -07:00
peter klausler 9e90c99e43 [flang] More expression analysis of literal constants.
Original-commit: flang-compiler/f18@3c89dace19
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:43 -07:00
peter klausler 62436d06cc [flang] Add data to a new formatted message.
Original-commit: flang-compiler/f18@04b1ae9e68
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:43 -07:00
peter klausler ce231b9559 [flang] Clean up messaging: make Say() member function templates more flexible, hide MessageFormattedText instances
Original-commit: flang-compiler/f18@59d774382f
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:17:40 -07:00
peter klausler 27be6855bf [flang] Expression analysis
Original-commit: flang-compiler/f18@6b5e23ba28
Reviewed-on: https://github.com/flang-compiler/f18/pull/165
Tree-same-pre-rewrite: false
2018-08-09 10:15:03 -07:00
Tim Keith ce0b722997 [flang] Merge pull request flang-compiler/f18#164 from flang-compiler/tsk9
Module file improvements

Original-commit: flang-compiler/f18@61598b59b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
2018-08-09 10:13:13 -07:00
Tim Keith 86a76d56ba [flang] Address review comments.
Original-commit: flang-compiler/f18@797ea41e17
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
2018-08-08 14:52:45 -07:00
Tim Keith 3d43ea663b [flang] Module file improvements
Verify that checksums are correct when reading a module file.

Don't write a module file if its current contents are correct.

Don't make .mod files read-only. It doesn't do much to prevent
users from editing them, checksum verification will detect when
it happens, and having them read-only causes problems if you then
compile with another compiler (e.g. PGI).

Original-commit: flang-compiler/f18@21d82aef6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/164
Tree-same-pre-rewrite: false
2018-08-08 11:36:24 -07:00
Peter Klausler 70dfdf979d [flang] Merge pull request flang-compiler/f18#162 from flang-compiler/pmk0
Roll up work on folding, descriptors, runtime, RESHAPE

Original-commit: flang-compiler/f18@967a334d72
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
2018-08-06 09:54:44 -07:00
peter klausler d2703b38e5 [flang] address review comments
Original-commit: flang-compiler/f18@a98942e396
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
2018-08-06 09:43:43 -07:00
peter klausler d4b12d4e84 [flang] Remove defined assignments from runtime representation.
Original-commit: flang-compiler/f18@720e71c5db
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:55:36 -07:00
peter klausler 3ace3e39c6 [flang] Rename some NaNs.
Original-commit: flang-compiler/f18@34eac17ddc
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:03 -07:00
peter klausler 9859b91602 [flang] clean up g++ 8.2.0 build warnings
Original-commit: flang-compiler/f18@0c946bef66
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:02 -07:00
peter klausler fac96c4612 [flang] test and debug RESHAPE
Original-commit: flang-compiler/f18@c20ce350c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:02 -07:00
peter klausler a8fed82258 [flang] Implement and test RESHAPE. Avoid G++ workaround when compiled with GNU 8.2.0.
Original-commit: flang-compiler/f18@80257ee0d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:01 -07:00
peter klausler 6f9fa21d50 [flang] Move descriptor flags into addendum.
Original-commit: flang-compiler/f18@f5839874ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:00 -07:00
peter klausler 51b3ceaafe [flang] Use a common enum class in evaluate and runtime for type category.
Original-commit: flang-compiler/f18@5012e652af
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:24:00 -07:00
peter klausler 2dce7b9554 [flang] break up runtime into multiple headers and source files
Original-commit: flang-compiler/f18@7863350552
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:59 -07:00
peter klausler 79c74948cc [flang] more descriptor work
Original-commit: flang-compiler/f18@0ab17048ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:59 -07:00
peter klausler e20784149f [flang] comments
Original-commit: flang-compiler/f18@b4423e3b1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:59 -07:00
peter klausler adc597b032 [flang] checkpoint work on descriptors
Original-commit: flang-compiler/f18@5e68ebea25
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:58 -07:00
peter klausler ab9d0987a2 [flang] character folding
Original-commit: flang-compiler/f18@5adc208bf2
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:58 -07:00
peter klausler fd6312ea05 [flang] complex and character comparisons
Original-commit: flang-compiler/f18@77ed88d24f
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:57 -07:00
peter klausler 439ddb334f [flang] Use std::nullopt in place of empty braces in return statements.
Original-commit: flang-compiler/f18@90e556301c
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:57 -07:00
peter klausler b861018e3a [flang] COMPLEX folding
Original-commit: flang-compiler/f18@6f1ef45b2f
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:56 -07:00
peter klausler bd146ed3e8 [flang] fold real**int
Original-commit: flang-compiler/f18@2dc2c2a6a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Tree-same-pre-rewrite: false
2018-08-03 16:23:56 -07:00
Peter Klausler b9631a5d74 [flang] Merge pull request flang-compiler/f18#163 from flang-compiler/pmk1
Restore buildability with clang

Original-commit: flang-compiler/f18@65c88ddf0f
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
2018-08-03 16:23:23 -07:00
peter klausler fd3a82772f [flang] Update README to reflect buildability with GCC 8.2.0.
Original-commit: flang-compiler/f18@f64a9f5b82
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
2018-08-03 16:11:29 -07:00
peter klausler ca5c265569 [flang] Add virtual IntExpr::~IntExpr to silence Clang warning about non-virtual dtor in a class with virtual functions.
Original-commit: flang-compiler/f18@b024ba50e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/163
Tree-same-pre-rewrite: false
2018-08-03 16:07:58 -07:00
Peter Klausler 3e4cf24ed4 [flang] Merge pull request flang-compiler/f18#161 from flang-compiler/pmk1
issue#159 - better error messages in face of garbled source that resembles Hollerith

Original-commit: flang-compiler/f18@5aedd0d72c
Reviewed-on: https://github.com/flang-compiler/f18/pull/161
2018-08-03 15:29:13 -07:00
peter klausler 837b6960a5 [flang] Make prescanner tokenization message re: Hollerith truncation a warning, so parser get a shot at it. Merge messages from failed parsing alternatives more informatively.
Original-commit: flang-compiler/f18@16ed01d8f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/161
2018-08-03 14:16:16 -07:00
Tim Keith e6528c15d5 [flang] Merge pull request flang-compiler/f18#160 from flang-compiler/tsk9
Add support for submodules

Original-commit: flang-compiler/f18@79f3632fc2
Reviewed-on: https://github.com/flang-compiler/f18/pull/160
2018-08-03 11:33:14 -07:00