Commit graph

110 commits

Author SHA1 Message Date
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
475d72f8e6 [flang] push for review
Original-commit: flang-compiler/f18@17dc735911
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 14:26:23 -08:00
peter klausler
4417443be9 [flang] Fix CHECK() on wa22 by implementing PGI language extension
Original-commit: flang-compiler/f18@03fcb58977
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:29:10 -08:00
peter klausler
2f12ee4f52 [flang] complete transfer of struct constructor code to expression.cc
Original-commit: flang-compiler/f18@e6178b2fc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:29:07 -08:00
peter klausler
f5bc9fd1d1 [flang] checkpoint, much code moved out of name resolution
Original-commit: flang-compiler/f18@8a081e82fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:28:09 -08:00
peter klausler
5b79ffc5f6 [flang] checkpoint
Original-commit: flang-compiler/f18@156791b288
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:10 -08:00
peter klausler
4313f4c762 [flang] checkpoint array/struct constructor work
Original-commit: flang-compiler/f18@b0a574fa35
Reviewed-on: https://github.com/flang-compiler/f18/pull/287
Tree-same-pre-rewrite: false
2019-02-15 12:22:09 -08:00
Tim Keith
d396a8845b [flang] Resolve kind parameters on literal constants
When the kind parameter is a constant name, that name must be resolved.

Add `CheckIntrinsicKind` and `CheckIntrinsicSize` for common checking of
valid intrinsic kinds. Previous we had different forms of the error
message depending on the context ( "unsupported INTEGER(KIND=47)" and
"INTEGER(KIND=47) is not a supported type").

Report error for parameters without initialization where are they
declared (in `Post(EntityDecl)`) rather than where they are referenced
(in `AnalyzeExpr`).

Remove error message from `AnalyzeKindParam`: `AnalyzeExpr` will report
the error (e.g. not integer, not constant, etc.).

Remove "name was not resolved" error from `AnalyzeExpr`: it should be
reported by name resolution.

Original-commit: flang-compiler/f18@9b0a99ce66
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
2019-02-08 16:03:23 -08:00
peter klausler
56bf4f8e0f [flang] fix crash found by tim
Original-commit: flang-compiler/f18@c24120d811
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
2019-02-04 13:06:21 -08:00
peter klausler
6d8aecf981 [flang] Convert structs to classes, move some defs from variable.h to call.h
Original-commit: flang-compiler/f18@c877a34694
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 16:04:17 -08:00
peter klausler
140b4adcfe [flang] Address review comments, fix some f90_correct failures
Original-commit: flang-compiler/f18@e468f8cd54
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:37 -08:00
peter klausler
1c95fef459 [flang] pass tests
Original-commit: flang-compiler/f18@db22dc2294
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:35 -08:00
peter klausler
650b32ebfe [flang] support Constant arrays
Original-commit: flang-compiler/f18@a92d8a404f
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:32 -08:00
peter klausler
0ae3d43d76 [flang] Run expression semantic analysis with rest of semantics.
checkpoint array constructor semantics work

checkpoint

array constructors of lengthless intrinsic types

checkpoint

Correct ambiguous substring refs misparsed as array elements

Original-commit: flang-compiler/f18@2232549efe
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
2019-01-31 09:59:28 -08:00
peter klausler
74a77dd2ed [flang] Use IEEE-754 terminology better: subnormal, not denormal(ized)
Original-commit: flang-compiler/f18@57b0ebb558
Reviewed-on: https://github.com/flang-compiler/f18/pull/273
2019-01-29 16:47:41 -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
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
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
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
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
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
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
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
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
ee2a32e561 [flang] Rework expression constraint checking
Original-commit: flang-compiler/f18@7a31c1ed2b
Reviewed-on: https://github.com/flang-compiler/f18/pull/250
Tree-same-pre-rewrite: false
2018-12-28 15:58:17 -08:00
Tim Keith
8ae55f79bc [flang] Rework when symbol table expressions are evaluated
It's not good enough to evaluate expressions in the symbol table after
name resolution has completed. This is because we need the values of
constant expressions for types, for example, we need to evaluate `k` in
`integer(k) :: x` to know the type of `x`.

So, eliminate `LazyExpr` and call `EvaluateExpr()` on expressions that
we need in the symbol table. The latter evaluates and folds an
expression in the current context. This is now possible because symbols
are added to `parser::Name` as soon as possible rather than in a pass
after name resolution. Along with `LazyExpr` we can eliminate the whole
`ResolveSymbolExprs` pass that used to resolve them.

In resolve-names.cc, many `Pre` functions are changed to `Post` so that
names are resolved before doing the associated processing. For example,
with intrinsic type specs, names in the kind expression must be resolved
before attempting to evaluate that expression.

In `GetSymbolType()` in type.cc, handle both `ObjectEntityDetails` and
`EntityDetails` by using `Symbol::GetType()`.

Add explicit declarations in label01.F90 because we can't handle
implicitly typed array bounds yet.

Original-commit: flang-compiler/f18@d67716640b
Reviewed-on: https://github.com/flang-compiler/f18/pull/238
2018-12-06 07:16:52 -08:00
peter klausler
1b1f60ff50 [flang] Use std::optional<>::value() where appropriate.
Original-commit: flang-compiler/f18@4278b79b3d
Reviewed-on: https://github.com/flang-compiler/f18/pull/237
Tree-same-pre-rewrite: false
2018-12-05 13:03:39 -08:00
peter klausler
d8f4072aba [flang] work around template specialization problem
Original-commit: flang-compiler/f18@1d67d72bea
Reviewed-on: https://github.com/flang-compiler/f18/pull/236
2018-12-04 15:52:50 -08:00
peter klausler
46aee9943c [flang] last minute changes for recent PR that were not pushed, sorry
Original-commit: flang-compiler/f18@9f9258e006
Reviewed-on: https://github.com/flang-compiler/f18/pull/235
2018-12-04 10:21:38 -08:00
peter klausler
34642dab32 [flang] fixes
Original-commit: flang-compiler/f18@d312b2298a
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
2018-12-03 17:20:28 -08:00
peter klausler
972e4b59d5 [flang] address review comments
Original-commit: flang-compiler/f18@2f4b7ac97c
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-12-03 16:44:25 -08:00
peter klausler
1089f0195c [flang] complete refactor of expression analysis api and impl
Original-commit: flang-compiler/f18@fc83cdeabb
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-12-03 11:40:53 -08:00
peter klausler
e5df69e965 [flang] checkpoint before another refactoring
Original-commit: flang-compiler/f18@033efb95c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-11-30 16:04:51 -08:00
peter klausler
4da74f5107 [flang] checkpoint
Original-commit: flang-compiler/f18@1c65ed9a6f
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-11-30 15:23:33 -08:00
peter klausler
659c32947c [flang] checkpoint during refactor
Original-commit: flang-compiler/f18@01fe82b95b
Reviewed-on: https://github.com/flang-compiler/f18/pull/234
Tree-same-pre-rewrite: false
2018-11-30 14:03:05 -08:00
Tim Keith
daa0b054ba [flang] Change formatting of common::visitors{}
Including a comma after the last lambda in a `common::visitors{}` list
causes clang-format to do a better job of formatting them.

Add that recommendation to C++style.md, insert the missing commas,
and reformat the changed files.

Original-commit: flang-compiler/f18@a2486ca3b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/232
2018-11-29 09:27:34 -08:00
peter klausler
3fc0f54b24 [flang] Analyze wrapped expressions
Original-commit: flang-compiler/f18@b34db5d38f
Reviewed-on: https://github.com/flang-compiler/f18/pull/228
2018-11-19 11:14:41 -08:00
peter klausler
4f6275a1f7 [flang] Rename Dump() as AsFortran(), tweak output for use in .mod files
Original-commit: flang-compiler/f18@4e9dd16d6a
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:03 -08:00
peter klausler
10aa1eafa0 [flang] multi-byte character TODOs
Original-commit: flang-compiler/f18@3bd2d227dc
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:02 -08:00
peter klausler
4e56600a8a [flang] more substring clean-up
Original-commit: flang-compiler/f18@e1c19ccd16
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:38:02 -08:00
peter klausler
cfb57cd2d3 [flang] take literal substrings out of variable.h
Original-commit: flang-compiler/f18@a762b70beb
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:37:15 -08:00
peter klausler
72fd06b389 [flang] Clean up Designator and GetSymbol()
Original-commit: flang-compiler/f18@61c0af323c
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:35:46 -08:00
peter klausler
03618fd5e3 [flang] Address TODO: define IsAssumedRank predicate, use it
Original-commit: flang-compiler/f18@f75c3e0ccf
Reviewed-on: https://github.com/flang-compiler/f18/pull/225
Tree-same-pre-rewrite: false
2018-11-08 09:33:57 -08:00
Tim Keith
9095548553 [flang] Resolve expressions in symbols
Add `LazyExpr` class to represent expressions in the symbol table.
Initially they contain a pointer to an expression in the parse tree.
After name resolution is complete and symbols are filled in in the parse
tree, `LazyExpr`s are resolved to `evaluate::Expr<evaluate::SomeType>`.
This is done by `ResolveSymbolExprs()`.

Change `Bound` and `ParamValue` to save their value as a `LazyExpr`.
Change `ObjectEntityDetails` and `TypeParamDetails` to save the initial
value as a `LazyExpr`.

Eliminate `IntExpr` and `IntConst` classes, which were just place-holders.

Add `Clone()` to `ShapeSpec`, `Bound`, `LazyExpr`. Normally they should
be moved but in `ObjectEntityDetails::set_shape()` we need to make copies.

Save type parameter values in `derivedTypeSpec_`. `typeParamValue_` is
not needed.

Write out initial values, type parameter values, and bounds to .mod files.

Evaluate parameter values in expressions.

Make some errors non-fatal so that tests can continue to pass.

Original-commit: flang-compiler/f18@b90cadfc53
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
Tree-same-pre-rewrite: false
2018-11-06 17:18:06 -08:00
Tim Keith
c59de6ca1d [flang] Use forward declarations to reduce includes
Original-commit: flang-compiler/f18@384af49342
Reviewed-on: https://github.com/flang-compiler/f18/pull/223
Tree-same-pre-rewrite: false
2018-11-05 15:03:46 -08:00
peter klausler
87b74269d5 [flang] prepare for merge
Original-commit: flang-compiler/f18@5d2490b1c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/219
Tree-same-pre-rewrite: false
2018-10-26 15:21:04 -07:00