Commit graph

1209 commits

Author SHA1 Message Date
peter klausler
f9d6c0a338 [flang] Move default intrinsic type kinds from lib/semantics to lib/common
Original-commit: flang-compiler/f18@887e72dd61
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:18 -08:00
Peter Klausler
5a3b1413f3 [flang] Merge pull request flang-compiler/f18#266 from flang-compiler/pmk-x86
Make x86 fp flag edge case behavior emulation conditional.

Original-commit: flang-compiler/f18@f21c9427fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/266
2019-01-22 16:24:58 -08:00
peter klausler
cfe14d0f0b [flang] Make x86 fp behavior emulation conditional.
Original-commit: flang-compiler/f18@0c77a634b3
Reviewed-on: https://github.com/flang-compiler/f18/pull/266
2019-01-22 11:13:44 -08:00
Peter Klausler
4e57640fd0 [flang] Merge pull request flang-compiler/f18#264 from flang-compiler/pmk1
Fix crash reported by Jean in error recovery case

Original-commit: flang-compiler/f18@e2117d367b
Reviewed-on: https://github.com/flang-compiler/f18/pull/264
2019-01-22 09:59:29 -08:00
peter klausler
a75f28a8a2 [flang] Fix crash reported by Jean in error recovery case
Original-commit: flang-compiler/f18@33db1790be
Reviewed-on: https://github.com/flang-compiler/f18/pull/264
2019-01-18 12:09:22 -08:00
Peter Klausler
d008e28476 [flang] Merge pull request flang-compiler/f18#260 from flang-compiler/pmk2
Complete parameterized derived type instantiation

Original-commit: flang-compiler/f18@3ecceb30d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
2019-01-18 12:03:38 -08:00
peter klausler
6d4f4b269b [flang] fix clang build warning
Original-commit: flang-compiler/f18@799fe63779
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
2019-01-18 10:45:07 -08:00
peter klausler
5ceaa14dd9 [flang] done with merge
Original-commit: flang-compiler/f18@9c63eb7a1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 16:14:36 -08:00
peter klausler
7f3590771e [flang] merge with master, implement a TODO with LEN on ASSOCIATE
Original-commit: flang-compiler/f18@e4501c6fa4
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 13:52:10 -08:00
peter klausler
be3b765e2a [flang] basic skeleton of assignment analyzer
remove needless template<> on some function overloads

dodge bogus compiler warning from gcc 8.1.0 only

stricter typing of expressions in symbols

adjust modfile12.f90 expected test results

add Unwrap, massage folding a bit

Use Unwrap to simplify folding

Move KindSelector analysis into expression semantics

fix crash

checkpoint

updates to TypeParamInquiry

support of %KIND type parameter inquiry

equality testing for expressions

checkpoint during PDT implementation

reformat

checkpoint derived type instantiation

checkpoint

resolve merge

debugging failed tests

fix failing resolve37.f90 test

all existing tests pass

clean up all build warnings

fix bug

update copyright dates

fix copyright dates

address review comments

review comment

merge with master after peeling off changes

bugfixing new feature

fix warning from old g++s

tweaks after merging with latest head

more bugfixing

making modfile17.f90 test work

Make kinds into expressions in symbol table types

big refactor for deferring kinds in intrinsic types

modfile17.f90 test passes

clean up TODOs

Simplify types as stored in scopes

Test KIND parameter default init expressions, debug them

Update copyright dates

address comments

remove dead line

address comments

Original-commit: flang-compiler/f18@1f43d0a048
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
2019-01-17 10:41:08 -08:00
Tim Keith
3035fc25a7 [flang] Merge pull request flang-compiler/f18#262 from flang-compiler/tsk4
Fix link error from last integration

Original-commit: flang-compiler/f18@2d8c0f3e08
Reviewed-on: https://github.com/flang-compiler/f18/pull/262
2019-01-16 17:29:07 -08:00
Tim Keith
42d7ac3e36 [flang] Fix link error from last integration
We need to be able to analyze the `Variable` in a `Selector` and an
expression. That worked in a previous iteration of `expression.h` by
analyzing each variant of `Variable`.

This fix adds an explicit public function to analyze a Variable and
return a `MaybeExpr`.

Original-commit: flang-compiler/f18@9848a5d48f
Reviewed-on: https://github.com/flang-compiler/f18/pull/262
2019-01-16 17:18:10 -08:00
Tim Keith
9b7ce28e35 [flang] Merge pull request flang-compiler/f18#261 from flang-compiler/tsk2
Resolve names in ASSOCIATE and SELECT TYPE

Original-commit: flang-compiler/f18@2e6932fb4a
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
2019-01-16 15:31:45 -08:00
Tim Keith
3020a18652 [flang] Fix typo
Original-commit: flang-compiler/f18@27af745986
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
2019-01-16 13:21:15 -08:00
Tim Keith
ee28b70827 [flang] Resolve names in ASSOCIATE and SELECT TYPE
Create `AssocEntityDetails` for symbols that represent entities
identified by the associate-name in ASSOCIATE and SELECT TYPE
constructs.

For ASSOCIATE, create a new scope for the associated entity.
For SELECT TYPE, create a new scope for each of type guard blocks.
Each one contains an associated entity with the appropriate type.

For SELECT TYPE, also create a place-holder symbol for the
associate-name in the SELECT TYPE statement. The real symbols
are in the new scopes and none of them is uniquely identified
with the associate-name.

Handling of `Selector` is common between these, with
`associate-name => expr | variable` recorded in
`ConstructVisitor::association_`.

When the selector is an expression, derive the type of the associated
entity from the type of the expression. This required some refactoring
of how `DeclTypeSpec`s are created. The `DerivedTypeSpec` that comes
from and expression is const so we can only create const `DeclTypeSpec`s
from it. But there were times during name resolution when we needed to
set type parameters in the current `DeclTypeSpec`. Now the non-const
`DerivedTypeSpec` is saved separately from the const `DeclTypeSpec`
while we are processing a declaration type spec. This makes it
unnecessary to save the derived type name.

Add a type alias for `common::Indirection` to reduce verbosity.

Original-commit: flang-compiler/f18@b7668cebe4
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
Tree-same-pre-rewrite: false
2019-01-15 16:59:20 -08:00
Eric Schweitz
6b678e48d8 [flang] Merge pull request flang-compiler/f18#259 from flang-compiler/eas2
Eas2

Original-commit: flang-compiler/f18@15fed72632
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
2019-01-10 16:13:40 -08:00
Eric Schweitz
d1c5ae55aa [flang] changes per review comments
Original-commit: flang-compiler/f18@8a3b5b5953
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
2019-01-10 12:13:45 -08:00
Eric Schweitz
349c623bba [flang] Fix typos on superscripts.
Original-commit: flang-compiler/f18@c9755c28f0
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Tree-same-pre-rewrite: false
2019-01-10 10:34:02 -08:00
Eric Schweitz
029b52a5e7 [flang] Add the Fortran IR document.
Original-commit: flang-compiler/f18@35a8c66e13
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Tree-same-pre-rewrite: false
2019-01-10 10:28:56 -08:00
Peter Klausler
409d26950b [flang] Merge pull request flang-compiler/f18#258 from flang-compiler/pmk1
cherrypick expression changes

Original-commit: flang-compiler/f18@470b03caee
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
2019-01-09 16:46:35 -08:00
peter klausler
70d7ab8789 [flang] address review comments
Original-commit: flang-compiler/f18@e770e52cb1
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
2019-01-09 16:39:58 -08:00
peter klausler
51dc18258b [flang] remove debugging output
Original-commit: flang-compiler/f18@3a156953c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
Tree-same-pre-rewrite: false
2019-01-09 15:13:23 -08:00
peter klausler
dc9faa270f [flang] cherrypick expression changes
Original-commit: flang-compiler/f18@427e267722
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
Tree-same-pre-rewrite: false
2019-01-09 15:06:07 -08:00
Tim Keith
003ab5d332 [flang] Merge pull request flang-compiler/f18#256 from flang-compiler/tsk6
More name resolution

Original-commit: flang-compiler/f18@3ea1c3bf4c
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
2019-01-08 14:21:28 -08:00
Tim Keith
7ec0830abd [flang] Resolve %kind and %len on intrinsic types
A `part-ref` can be `%kind` on an entity of any intrinsic type or
`%len` on a character entity. During name resolution, recognize these
and don't report an error as if they are component references.

Create symbols for these names as well as `%re` and `%im`. This is
partly for completeness so that we don't get warnings about unresolve
names. It also allows us to avoid having to do string comparisons on
these names in more than one place.

Rework `AnalyzeExpr` on structure components to make use of these
symbols and also not treat `%kind` and `%len` as derived type component
references.

Original-commit: flang-compiler/f18@65ae81ebac
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
2019-01-08 12:14:35 -08:00
Tim Keith
9ae71a0357 [flang] Fix crash evaluating kind expression
If we fail to evaluate the kind expression we were getting an invalid
optional reference. Instead, fail with an assert. This can happen if an
intrinsic function is not folded, but that will be implemented
eventually.

Original-commit: flang-compiler/f18@3bdbfc34bb
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tree-same-pre-rewrite: false
2019-01-08 12:14:35 -08:00
Tim Keith
44e7fee6d0 [flang] Bug fix: pass right value as MiscDetails::Kind
Original-commit: flang-compiler/f18@94d63399bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tree-same-pre-rewrite: false
2019-01-08 12:14:35 -08:00
Tim Keith
a1a55f007c [flang] Resolve name in PASS and BIND attributes
These are recognized along with other attributes and saved in
`passName_` and `bindName_`. The functions `SetPassNameOn()` and
`SetBindNameOn()` set them in a symbol if they are present.
They are also written to `.mod` files.

Add `MakePlaceholder()` to make symbols for names that otherwise
wouldn't have one. This allows us to assign a symbol to every name
and report errors for those that don't have one. Make use of this
for PASS names, which don't have explicit symbols.

Change `ObjectEntityDetails` and `ProcEntityDetails` to be sub-classes
of `EntityDetails`. They each contain a superset of the information in
`EntityDetails` so this reduces some duplication.

Original-commit: flang-compiler/f18@404c920840
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tree-same-pre-rewrite: false
2019-01-08 12:14:35 -08:00
Peter Klausler
845e02d1e1 [flang] Merge pull request flang-compiler/f18#248 from pjh40/pjh2
Define non-inline versions of ExpressionBase::derived()

Original-commit: flang-compiler/f18@f78bba7490
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
2019-01-08 11:32:51 -08:00
Paul Henning
778e615158 [flang] Added preprocessor directives to limit the use of non-inline ExpressionBase<A>::derived to GCC on Mac (inlined on all other platforms)
Original-commit: flang-compiler/f18@b38b31909a
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
2019-01-03 09:45:27 -07:00
Paul Henning
b61b31dfcd [flang] Addresses issue flang-compiler/f18#242 by making non-inline definitions for the two versions
of ExpressionBase::derived().  gcc-8.2 on macOS was choosing to create
non-inline instances of derived() during the explicit instantiations of
ExpressionBase in expression.cc and fold.cc.  During linking of any
executable, the linker failed when it found these duplicate definitions.

While this solution works, it removes the opportunity to inline the trivial
derived() functions.  Another solution would be to make all of the
templates related to ExpressionBase in expression.cc and fold.cc available
in a single .cc file, where the explicit instantiation
FOR_EACH_TYPE_AND_KIND(template class ExpressionBase) is done once. This
approach would allow inlining, but require something like template
implementation headers that could be included into the instantiation .cc
file.

Original-commit: flang-compiler/f18@074de39418
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
Tree-same-pre-rewrite: false
2018-12-20 10:39:29 -07:00
Peter Klausler
eef439577c [flang] Merge pull request flang-compiler/f18#255 from flang-compiler/pmk1
Minor clean-up after a merge

Original-commit: flang-compiler/f18@4bd4a2045f
Reviewed-on: https://github.com/flang-compiler/f18/pull/255
2019-01-08 10:50:12 -08:00
peter klausler
4d115f2383 [flang] Restore readability improvement from code review comment that did not make it into a merge into master, and repair expected test results.
Original-commit: flang-compiler/f18@4f1946765e
Reviewed-on: https://github.com/flang-compiler/f18/pull/255
2019-01-08 09:56:57 -08:00
peter klausler
7e837d117f [flang] address review comment
Original-commit: flang-compiler/f18@3542f64813
Reviewed-on: https://github.com/flang-compiler/f18/pull/255
Tree-same-pre-rewrite: false
2019-01-07 17:01:49 -08:00
Peter Klausler
7673e0944c [flang] Merge pull request flang-compiler/f18#254 from flang-compiler/pmk3
Roll up small tweaks to parser and semantics.

Original-commit: flang-compiler/f18@36601dd6ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/254
2019-01-07 16:45:08 -08:00
peter klausler
e30ef0ec8d [flang] Roll up small tweaks to parser and semantics.
Original-commit: flang-compiler/f18@57d823a809
Reviewed-on: https://github.com/flang-compiler/f18/pull/254
2019-01-07 15:38:48 -08:00
Peter Klausler
8416801439 [flang] Merge pull request flang-compiler/f18#253 from flang-compiler/pmk1
Symbol changes for PDT instantiation

Original-commit: flang-compiler/f18@d3c16c6a80
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
2019-01-07 16:44:42 -08:00
peter klausler
5cf5315343 [flang] fold analyzed bounds expressions
Original-commit: flang-compiler/f18@17810319ae
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
2019-01-07 16:31:59 -08:00
peter klausler
e760aaa4e6 [flang] fix copyright dates
Original-commit: flang-compiler/f18@75818658d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:50:04 -08:00
peter klausler
e828e0c795 [flang] Update copyright dates.
Original-commit: flang-compiler/f18@8a7722621b
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:42:36 -08:00
peter klausler
32ba1a4a8c [flang] fix comment
Original-commit: flang-compiler/f18@2b06aff9b4
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:20:57 -08:00
peter klausler
13ed85789d [flang] Symbol changes for PDT instantiation
Original-commit: flang-compiler/f18@0c545a026d
Reviewed-on: https://github.com/flang-compiler/f18/pull/253
Tree-same-pre-rewrite: false
2019-01-07 15:05:53 -08:00
Peter Klausler
d3e451365f [flang] Merge pull request flang-compiler/f18#252 from flang-compiler/pmk3
Roll up folding & expression changes

Original-commit: flang-compiler/f18@608139c160
Reviewed-on: https://github.com/flang-compiler/f18/pull/252
2019-01-07 10:55:40 -08:00
peter klausler
67f13efa44 [flang] update copyright dates
Original-commit: flang-compiler/f18@99f4c98ccb
Reviewed-on: https://github.com/flang-compiler/f18/pull/252
2019-01-07 10:55:09 -08:00
peter klausler
fe3acf5ffc [flang] Roll up folding & expression changes
Original-commit: flang-compiler/f18@60affece05
Reviewed-on: https://github.com/flang-compiler/f18/pull/252
Tree-same-pre-rewrite: false
2019-01-07 10:15:27 -08:00
Peter Klausler
0a810d5207 [flang] Merge pull request flang-compiler/f18#251 from flang-compiler/pmk3
Support operator== for expressions.

Original-commit: flang-compiler/f18@b43f5fa583
Reviewed-on: https://github.com/flang-compiler/f18/pull/251
2019-01-04 14:35:05 -08:00
peter klausler
2ad9986698 [flang] Support operator== for expressions.
Original-commit: flang-compiler/f18@42013513e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/251
2019-01-04 14:05:53 -08:00
Peter Klausler
b45b098d0f [flang] Merge pull request flang-compiler/f18#250 from flang-compiler/pmk1
Change expression constraint checking

Original-commit: flang-compiler/f18@c40ce62f12
Reviewed-on: https://github.com/flang-compiler/f18/pull/250
2018-12-28 16:54:57 -08:00
peter klausler
d1d894c907 [flang] final clean-up
Original-commit: flang-compiler/f18@b971754a20
Reviewed-on: https://github.com/flang-compiler/f18/pull/250
2018-12-28 16:52:57 -08:00
peter klausler
7187fbcc6d [flang] Remove a little now-dead code.
Original-commit: flang-compiler/f18@f000fb974c
Reviewed-on: https://github.com/flang-compiler/f18/pull/250
Tree-same-pre-rewrite: false
2018-12-28 16:36:46 -08:00