Commit graph

1377 commits

Author SHA1 Message Date
jeanPerier
db38488ecd [flang] Merge pull request flang-compiler/f18#227 from flang-compiler/jpr0
Implement CFI_set_pointer, CFI_section, CFI_select_part. Minor changes in other CFI funcs

Original-commit: flang-compiler/f18@357f3d67da
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
2019-01-24 09:33:12 -08:00
Jean Perier
1131551d0a [flang] Removed unnecessary reinterpret_cast.
Original-commit: flang-compiler/f18@dd08a7fd3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
2018-11-29 13:17:53 -08:00
Jean Perier
8e76e8727b [flang] Fix: CFI_type_char is now considered Fortran CHARACTER
Original-commit: flang-compiler/f18@7c23573bd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-28 12:17:34 -08:00
Jean Perier
9b3d9e52f2 [flang] Added nullptr check in CFI functions returning error codes
Original-commit: flang-compiler/f18@5213d3a921
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-27 16:07:21 -08:00
Jean Perier
a4e942aedf [flang] Changed CFI_CDESC_T c++ macro and various other comment fixes
-  CFI_CDESC_T can now be cast to CFI_cdesc_t without using
    reinterpret_cast.
 -  Use {} initialization everywhere according to style guideline
 -  Avoid useless parentheses
 -  Do not use static storage when useless in tests.
 -  Reodered some loops that were confusing in tests

Original-commit: flang-compiler/f18@d0ed631dfd
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-27 14:13:21 -08:00
Jean Perier
2d7b243369 [flang] editorial change after review
Original-commit: flang-compiler/f18@92339ea11a
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-26 15:31:07 -08:00
Jean Perier
2b634a6f45 [flang] fix review comments
Original-commit: flang-compiler/f18@5d9ef043a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-19 09:10:08 -08:00
Jean Perier
4a4ca14cb2 [flang] Comment typos correction
Original-commit: flang-compiler/f18@107c105636
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-19 08:59:07 -08:00
Jean Perier
218a5aa56a [flang] Set lower bounds to 0 in CFI_establish, CFI_select_part and CFI_setpointer
Original-commit: flang-compiler/f18@65c67347d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-19 07:50:30 -08:00
Jean Perier
0562341063 [flang] CFI_allocate: fixed CFI_type_char/cptr
Original-commit: flang-compiler/f18@ba9274d3ee
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-16 08:00:41 -08:00
Jean Perier
cc436e74df [flang] CFI_set_pointer, CFI_section, CFI_select_part and tests
Original-commit: flang-compiler/f18@e3830c5878
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
2018-11-16 07:10:04 -08:00
Peter Klausler
8f49363a8c [flang] Merge pull request flang-compiler/f18#265 from flang-compiler/pmk0
Enable shared library build without dependence cycle between binaries

Original-commit: flang-compiler/f18@bcd1a5f38b
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
2019-01-23 16:32:04 -08:00
peter klausler
7f4fb7f89f [flang] update copyright date
Original-commit: flang-compiler/f18@c9dbc96042
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
2019-01-23 16:31:17 -08:00
peter klausler
85ea49eaba [flang] tweak CMakeLists.txt options
Original-commit: flang-compiler/f18@64ba0c0d6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:21 -08:00
peter klausler
9d63306d76 [flang] Remove SHARED from add_library(), use cmake command line option instead
Original-commit: flang-compiler/f18@6644c799a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:20 -08:00
peter klausler
f47c0bdaba [flang] Add SHARED to add_library() invocations so f18 libraries are always built shared.
Original-commit: flang-compiler/f18@060ced04c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:20 -08:00
peter klausler
db5b3fbd89 [flang] Enable building f18 as shared libraries
Original-commit: flang-compiler/f18@4544d75af1
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:19 -08:00
peter klausler
e7b93436c3 [flang] Rearrange code to eliminate dependence cycles between f18 library binaries
Original-commit: flang-compiler/f18@88651eecae
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
2019-01-22 16:31:19 -08:00
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