Tim Keith [Fri, 15 Feb 2019 18:24:51 +0000 (10:24 -0800)]
[flang] Merge pull request flang-compiler/f18#286 from flang-compiler/tsk3
Add support for common blocks
Original-commit: flang-compiler/f18@
6a37805094865577c9e215546eee562c76d56db2
Reviewed-on: https://github.com/flang-compiler/f18/pull/286
Tim Keith [Thu, 14 Feb 2019 15:59:20 +0000 (07:59 -0800)]
[flang] Add support for common blocks
A symbol for a common block has `CommonBlockDetails` which contains
a list of the symbols that are in the common block.
The name of the symbol for the blank common block is the empty string.
That preserves the property that every symbol name is a substring of
the cooked source. We use the 0-length substring starting at the COMMON
statement so that when symbols are sorted by the location of the start
of the name it ends up in the right place.
Some of the checks on members of common blocks don't happen until the
end of the scope. They can't happen earlier because we don't necessarily
know the type and attributes.
Enhance `test_errors.sh` so that multiple errors can be expected for
a single line.
Original-commit: flang-compiler/f18@
2c4ca6b5d3e5798ef7815a52739a3e642bebd1c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/286
Tim Keith [Thu, 14 Feb 2019 16:41:03 +0000 (08:41 -0800)]
[flang] Merge pull request flang-compiler/f18#282 from flang-compiler/tsk1
Document describing overview of compiler phases
Original-commit: flang-compiler/f18@
9648645634b4cd134f9ca3c8d4e83c33b36bd9b1
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
Tim Keith [Thu, 14 Feb 2019 16:40:19 +0000 (08:40 -0800)]
[flang] Address rest of review comments
Original-commit: flang-compiler/f18@
3aa7303a308e6ecdf22fc217daa28cfe3d273310
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
Tim Keith [Tue, 12 Feb 2019 18:40:52 +0000 (10:40 -0800)]
[flang] Address review comments
Original-commit: flang-compiler/f18@
6b42a1777f4d9b0135b391a6ef97e2af41733060
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
Tree-same-pre-rewrite: false
Tim Keith [Tue, 12 Feb 2019 00:33:20 +0000 (16:33 -0800)]
[flang] Document describing overview of compiler phases
Original-commit: flang-compiler/f18@
ac7a492a25733fa497267cff3aaae724eb3f9d5b
Reviewed-on: https://github.com/flang-compiler/f18/pull/282
Tree-same-pre-rewrite: false
Tim Keith [Wed, 13 Feb 2019 00:22:15 +0000 (16:22 -0800)]
[flang] Merge pull request flang-compiler/f18#284 from flang-compiler/tsk3
Simplify CommonStmt in parse tree
Original-commit: flang-compiler/f18@
5f5430af333a46e843cc7fdefcb9b759ec1bb642
Reviewed-on: https://github.com/flang-compiler/f18/pull/284
Tim Keith [Wed, 13 Feb 2019 00:13:58 +0000 (16:13 -0800)]
[flang] Simplify CommonStmt in parse tree
The grammar requires parsing the first common block in a common stmt
differently from the others: the '//' is optional for the blank common.
But once it's parsed, it is easier to work with if each is represented
as a `parser::CommonStmt::Block`. This is achieved by using the same
constructor for `CommonStmt` but then including the first block in
the list of blocks.
Original-commit: flang-compiler/f18@
dd46afd6b5607ec61ea9b2e97efa16deda31441b
Reviewed-on: https://github.com/flang-compiler/f18/pull/284
Tim Keith [Wed, 13 Feb 2019 00:18:41 +0000 (16:18 -0800)]
[flang] Merge pull request flang-compiler/f18#281 from flang-compiler/tsk4
More name resolution improvements
Original-commit: flang-compiler/f18@
4466041ad0deba9b43f5f0bf3a7ac8477e4e92da
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tim Keith [Mon, 11 Feb 2019 18:58:20 +0000 (10:58 -0800)]
[flang] Strengthen checking for unresolved names
Make it a fatal error to have an unresolved name, except for a few
exceptions.
Remove namelist, bind, save statements from the exceptions.
Original-commit: flang-compiler/f18@
b16cbed780964e48dcba41548ce92dcf42716a98
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tim Keith [Mon, 11 Feb 2019 18:49:48 +0000 (10:49 -0800)]
[flang] Fix bug setting type from association expression
When an association selector is an expression, we get the type of the
associate-name from the type of the expression. If that is a derived
type, we were failing to get the derived type scope in copy of the
type that was made. That meant the component names were not resolved.
The fix is to copy the scope in the copy and move constructors of
`DerivedTypeSpec`. As a result, `DerivedTypeSpec::Instantiate` cannot
assume that the `scope_` is not set.
Original-commit: flang-compiler/f18@
79eaa8c47fc0f1c1c71bf2760ec0a1e39e2a55ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
Tim Keith [Sat, 9 Feb 2019 00:17:52 +0000 (16:17 -0800)]
[flang] Always resolve associate-name in select-type
Even if the selector expression has an error, we can resolve the
associate-name.
Original-commit: flang-compiler/f18@
3c35c30f581b2ef0d7d74af8fddfc4adaba9d6c0
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
Tim Keith [Sat, 9 Feb 2019 00:03:23 +0000 (16:03 -0800)]
[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@
9b0a99ce6696fe7db7708ea0362e103faa509968
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
Tim Keith [Fri, 8 Feb 2019 16:57:28 +0000 (08:57 -0800)]
[flang] Resolve binding names in type-bound generic
Enhance `FindInTypeOrParents()` to also accept a `parser::Name` argument
and to resolve that name when the symbol is found. This causes binding
names in type-bound generic statements to be resolved. Move this process
to the beginning of the handling of such statements so that they are
resolve even if the generic spec is not and we return early.
Also resolve type parameter keywords in derived type specs
(e.g. `k` in `type(k=1) :: x`). That involves collecting and searching
the symbols of the `TypeParamDetails` to match the name with the symbol.
Original-commit: flang-compiler/f18@
7387fb436d6d61bafe202f1d85a1e1ea824c7a32
Reviewed-on: https://github.com/flang-compiler/f18/pull/281
Tree-same-pre-rewrite: false
Eric Schweitz [Fri, 8 Feb 2019 20:01:03 +0000 (12:01 -0800)]
[flang] Merge pull request flang-compiler/f18#280 from flang-compiler/eas6
Fix for both issues 274 and 278
Original-commit: flang-compiler/f18@
3dc5b01a3f53e46ed2b135d690a18b650ab83cac
Reviewed-on: https://github.com/flang-compiler/f18/pull/280
Eric Schweitz [Fri, 8 Feb 2019 18:53:18 +0000 (10:53 -0800)]
[flang] Fix for both issues 274 and 278
Original-commit: flang-compiler/f18@
9bb54046c7ab1404533120eb3f321d6d911c0c4e
Reviewed-on: https://github.com/flang-compiler/f18/pull/280
Eric Schweitz [Fri, 8 Feb 2019 00:58:19 +0000 (16:58 -0800)]
[flang] Merge pull request flang-compiler/f18#279 from flang-compiler/eas5
Fixes infinite loop in tests
Original-commit: flang-compiler/f18@
85cf54e9854faf070358d0657b5f6fdc25d841b8
Reviewed-on: https://github.com/flang-compiler/f18/pull/279
Eric Schweitz [Fri, 8 Feb 2019 00:41:18 +0000 (16:41 -0800)]
[flang] Fixes infinite loop in tests
Original-commit: flang-compiler/f18@
2fa96b77345b6c6baa781b53712d9590eca41c68
Reviewed-on: https://github.com/flang-compiler/f18/pull/279
Tim Keith [Thu, 7 Feb 2019 20:27:25 +0000 (12:27 -0800)]
[flang] Merge pull request flang-compiler/f18#277 from flang-compiler/tsk4c
Name resolution for namelist and data statements
Original-commit: flang-compiler/f18@
c6d4360f3c0bc8632c5cd305de1c4df8dd08a2e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tim Keith [Thu, 7 Feb 2019 20:25:59 +0000 (12:25 -0800)]
[flang] Address review comments
Original-commit: flang-compiler/f18@
9daa2351c2a6f8d67267d6b0e44f0cf25bd1acad
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tim Keith [Thu, 7 Feb 2019 01:18:02 +0000 (17:18 -0800)]
[flang] Improvements to name resolution in data statements
Handle variables in data statements differently from implied dos:
If a variable is first mentioned in a data statement, it is implicitly
declared in the current scope (and subsequent type declarations only
confirm the type).
In the implied do case, the only variables that can be implicitly
declared are the iteration variables. They must be created in the new
ImpliedDos scope. There must be one such scope for each data-stmt-object
because the variable name can be reused.
Resolve references to named constants, e.g. in complex-literal-constant
and data-stmt-value. This requires changing the handling of
named-constant-def as that is a definition, not a reference.
Original-commit: flang-compiler/f18@
9952b56af090b307f03202c128f242866d76d1a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
Tim Keith [Wed, 6 Feb 2019 18:28:31 +0000 (10:28 -0800)]
[flang] Add Symbol::IsArray()
Add and use IsArray for symbols, meaning: it is an object entity
with shape.
Original-commit: flang-compiler/f18@
31c1a37f03493c7ab56122986f07bb67153b3d91
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
Tim Keith [Tue, 5 Feb 2019 22:43:00 +0000 (14:43 -0800)]
[flang] Resolve namelist group and object names
Namelist groups are represents by symbols with `NamelistDetails`.
Those contain a list of symbols representing the objects in the group.
References to namelist groups in io-control-spec are resolved.
In `.mod` files, namelist groups are written out at the end of the
module specification section. This is so that the declarations of the
objects in the namelist group appear before they are referenced.
Original-commit: flang-compiler/f18@
8b70dbcac77f287725a8772899c5ea5ff093e25f
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
Tim Keith [Tue, 5 Feb 2019 21:51:36 +0000 (13:51 -0800)]
[flang] Add SayWithDecl function for error reporting
Add `SayWithDecl` to handle the common case of reporting an error about
a symbol and referencing its original declaration.
Original-commit: flang-compiler/f18@
cf4d6fbe7f6b977f8b683a37a47109f642e2a44c
Reviewed-on: https://github.com/flang-compiler/f18/pull/277
Tree-same-pre-rewrite: false
Eric Schweitz [Wed, 6 Feb 2019 00:55:22 +0000 (16:55 -0800)]
[flang] Merge pull request flang-compiler/f18#276 from flang-compiler/eas3
Issue flang-compiler/f18#274 - add separate scopes for each procedure in the module
Original-commit: flang-compiler/f18@
64e175ceb03e835d2e33ee841b4b6eb4ea4e1b23
Reviewed-on: https://github.com/flang-compiler/f18/pull/276
Eric Schweitz [Tue, 5 Feb 2019 18:27:32 +0000 (10:27 -0800)]
[flang] identifier conformity
Original-commit: flang-compiler/f18@
7d6e28f6997172f3d5bbaa66fc35fad021306235
Reviewed-on: https://github.com/flang-compiler/f18/pull/276
Eric Schweitz [Tue, 5 Feb 2019 17:43:51 +0000 (09:43 -0800)]
[flang] Issue flang-compiler/f18#274 - add separate scopes for each procedure in the module
Original-commit: flang-compiler/f18@
d8f6b6617858a320fefab640fdc8a1a92b86ef6f
Reviewed-on: https://github.com/flang-compiler/f18/pull/276
Tree-same-pre-rewrite: false
Peter Klausler [Mon, 4 Feb 2019 21:38:08 +0000 (13:38 -0800)]
[flang] Merge pull request flang-compiler/f18#271 from flang-compiler/pmk-exprs
Semantic analysis & folding of array constructors
Original-commit: flang-compiler/f18@
00be335567ceb320a47eccc76be51d1cb07974b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
peter klausler [Mon, 4 Feb 2019 21:06:21 +0000 (13:06 -0800)]
[flang] fix crash found by tim
Original-commit: flang-compiler/f18@
c24120d8116c58ceaed6e70fb1cedeb517ddb4a4
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
peter klausler [Mon, 4 Feb 2019 18:39:41 +0000 (10:39 -0800)]
[flang] address comments
Original-commit: flang-compiler/f18@
ccbb1a2036d818f167216ee6b107048afff3765c
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Fri, 1 Feb 2019 21:37:49 +0000 (13:37 -0800)]
[flang] More value semantics in Constant<> and GetScalarConstantValue
Original-commit: flang-compiler/f18@
c7acce46854f815e2a1c53d385d8c39bae23098e
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Fri, 1 Feb 2019 00:04:17 +0000 (16:04 -0800)]
[flang] Convert structs to classes, move some defs from variable.h to call.h
Original-commit: flang-compiler/f18@
c877a34694f041ab4d05f1d09c7105db10a90d41
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Thu, 31 Jan 2019 21:18:30 +0000 (13:18 -0800)]
[flang] fix f90_correct failure
Original-commit: flang-compiler/f18@
1d9dac8ab57a5f56770a204857abed254b13fbf3
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Thu, 31 Jan 2019 19:44:13 +0000 (11:44 -0800)]
[flang] Fix instantiation of PDT bindings
Original-commit: flang-compiler/f18@
8dcfe0c70b2b17d8c46c5e7659986c4bc7cd7762
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Thu, 31 Jan 2019 18:16:26 +0000 (10:16 -0800)]
[flang] add conversions to array constructor test
Original-commit: flang-compiler/f18@
881c195a265296aa865bfe35aff006aeec3b3f61
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Thu, 31 Jan 2019 17:58:40 +0000 (09:58 -0800)]
[flang] Address review comments, fix some f90_correct failures
Original-commit: flang-compiler/f18@
e468f8cd54f95b83acdcafd3e1909cef98293cd3
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Tue, 29 Jan 2019 22:31:47 +0000 (14:31 -0800)]
[flang] pass tests
Original-commit: flang-compiler/f18@
db22dc22946eae605a4adfeb5a5becdb5bf63560
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Tue, 29 Jan 2019 18:22:18 +0000 (10:22 -0800)]
[flang] array constructor folding with test
Original-commit: flang-compiler/f18@
37e7a8e666eae80d4d5485e8c9c59bfb23d08fa9
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Tue, 29 Jan 2019 00:56:50 +0000 (16:56 -0800)]
[flang] folding array constructors
Original-commit: flang-compiler/f18@
a4e045fc5a913c7c3814820bf662205cc7687f1e
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Mon, 28 Jan 2019 22:38:17 +0000 (14:38 -0800)]
[flang] support Constant arrays
Original-commit: flang-compiler/f18@
a92d8a404fc44d593890d79d59cf62630399d639
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
peter klausler [Wed, 23 Jan 2019 00:30:32 +0000 (16:30 -0800)]
[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@
2232549efe42a2ef97725a131ac642b9be9274f4
Reviewed-on: https://github.com/flang-compiler/f18/pull/271
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 31 Jan 2019 17:56:28 +0000 (09:56 -0800)]
[flang] Merge pull request flang-compiler/f18#272 from flang-compiler/pmk-fix
Fix bugs flang-compiler/f18#269 & flang-compiler/f18#270
Original-commit: flang-compiler/f18@
f9aecb6330ec41dcc34adf86b137308d6356a4cf
Reviewed-on: https://github.com/flang-compiler/f18/pull/272
peter klausler [Wed, 30 Jan 2019 18:31:26 +0000 (10:31 -0800)]
[flang] Update fix based on comment
Original-commit: flang-compiler/f18@
52dfd3b5dcdd84e5146875a6afdd075fe4acd9d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/272
peter klausler [Wed, 30 Jan 2019 00:15:35 +0000 (16:15 -0800)]
[flang] Fix bugs flang-compiler/f18#269 & flang-compiler/f18#270
Original-commit: flang-compiler/f18@
639816f3efa7907d07c724e15d13afa5d4fe7794
Reviewed-on: https://github.com/flang-compiler/f18/pull/272
Tree-same-pre-rewrite: false
Peter Klausler [Wed, 30 Jan 2019 17:55:05 +0000 (09:55 -0800)]
[flang] Merge pull request flang-compiler/f18#273 from flang-compiler/pmk-subnormal
Use IEEE-754 terminology better: subnormal, not denormal(ized)
Original-commit: flang-compiler/f18@
700613d423bb265a6c5962197318478e4ba161d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/273
peter klausler [Wed, 30 Jan 2019 00:47:41 +0000 (16:47 -0800)]
[flang] Use IEEE-754 terminology better: subnormal, not denormal(ized)
Original-commit: flang-compiler/f18@
57b0ebb5580a57d4dae44565d74e7ab19b88662b
Reviewed-on: https://github.com/flang-compiler/f18/pull/273
jeanPerier [Mon, 28 Jan 2019 09:25:37 +0000 (01:25 -0800)]
[flang] Fixes issue flang-compiler/f18#267 (GetScalarConstantValue)
Merge pull request flang-compiler/f18#268 from flang-compiler/jpr0
Original-commit: flang-compiler/f18@
d29624b54245936cbe87885e6cfb1d674b8449ec
Jean Perier [Fri, 25 Jan 2019 11:24:31 +0000 (03:24 -0800)]
[flang] Cleaned folding test helper template
Original-commit: flang-compiler/f18@
b402c0a09caf079d2a0a44ac339894412c491e74
Jean Perier [Thu, 24 Jan 2019 17:49:00 +0000 (09:49 -0800)]
[flang] Add test related to issue flang-compiler/f18#267
Original-commit: flang-compiler/f18@
a9b2a05f7533546d5f791d5558017c45430e1077
Tree-same-pre-rewrite: false
Jean Perier [Thu, 24 Jan 2019 17:46:35 +0000 (09:46 -0800)]
[flang] Fix issue flang-compiler/f18#267 (GetScalarConstantValue)
Original-commit: flang-compiler/f18@
9fcbd09a51e935572e63bab6a5b30206375b24f6
Tree-same-pre-rewrite: false
jeanPerier [Thu, 24 Jan 2019 17:33:12 +0000 (09:33 -0800)]
[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@
357f3d67da756c7b7542e893b9cfab4af393b740
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Jean Perier [Thu, 29 Nov 2018 21:17:53 +0000 (13:17 -0800)]
[flang] Removed unnecessary reinterpret_cast.
Original-commit: flang-compiler/f18@
dd08a7fd3c899aacf51c85fff57692cf16ce92a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Jean Perier [Wed, 28 Nov 2018 20:17:34 +0000 (12:17 -0800)]
[flang] Fix: CFI_type_char is now considered Fortran CHARACTER
Original-commit: flang-compiler/f18@
7c23573bd9630976daf9368913a4d7b71d1ffb3e
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Wed, 28 Nov 2018 00:07:21 +0000 (16:07 -0800)]
[flang] Added nullptr check in CFI functions returning error codes
Original-commit: flang-compiler/f18@
5213d3a92119e509a173aa74abbe794a70b0c9aa
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Tue, 27 Nov 2018 22:13:21 +0000 (14:13 -0800)]
[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@
d0ed631dfdabfb162e3518f7e950ea4f9853c71a
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Mon, 26 Nov 2018 23:31:07 +0000 (15:31 -0800)]
[flang] editorial change after review
Original-commit: flang-compiler/f18@
92339ea11a09323cda461da0e69a52a006cf6df8
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Mon, 19 Nov 2018 17:10:08 +0000 (09:10 -0800)]
[flang] fix review comments
Original-commit: flang-compiler/f18@
5d9ef043a63a7e9beac3af632ba51f85931742a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Mon, 19 Nov 2018 16:54:58 +0000 (08:54 -0800)]
[flang] Comment typos correction
Original-commit: flang-compiler/f18@
107c10563656164de091b806bf5d31faecb503cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Mon, 19 Nov 2018 15:50:30 +0000 (07:50 -0800)]
[flang] Set lower bounds to 0 in CFI_establish, CFI_select_part and CFI_setpointer
Original-commit: flang-compiler/f18@
65c67347d9530cce293f1f90089fb4e8186ccabc
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Fri, 16 Nov 2018 16:00:41 +0000 (08:00 -0800)]
[flang] CFI_allocate: fixed CFI_type_char/cptr
Original-commit: flang-compiler/f18@
ba9274d3ee7e24c0b2be48c1ba32e9682cbc4f18
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Jean Perier [Fri, 16 Nov 2018 15:10:04 +0000 (07:10 -0800)]
[flang] CFI_set_pointer, CFI_section, CFI_select_part and tests
Original-commit: flang-compiler/f18@
e3830c5878d7dbcdcc2652ac5ab97ddca6be60a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/227
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 24 Jan 2019 00:32:04 +0000 (16:32 -0800)]
[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@
bcd1a5f38baa0df58d044526a5fb21136e78e664
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
peter klausler [Thu, 24 Jan 2019 00:31:17 +0000 (16:31 -0800)]
[flang] update copyright date
Original-commit: flang-compiler/f18@
c9dbc96042d4f73d6a8679f08a7eddfa4ddd6d98
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
peter klausler [Wed, 23 Jan 2019 00:03:02 +0000 (16:03 -0800)]
[flang] tweak CMakeLists.txt options
Original-commit: flang-compiler/f18@
64ba0c0d6e55a1dadc949ede016edb1f39a6ee7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
peter klausler [Sat, 19 Jan 2019 23:30:25 +0000 (15:30 -0800)]
[flang] Remove SHARED from add_library(), use cmake command line option instead
Original-commit: flang-compiler/f18@
6644c799a7dc583331bea9853700c2ba69bbab4e
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
peter klausler [Sat, 19 Jan 2019 22:57:04 +0000 (14:57 -0800)]
[flang] Add SHARED to add_library() invocations so f18 libraries are always built shared.
Original-commit: flang-compiler/f18@
060ced04c74b8796c7621a29da86ee2051d3ccba
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
peter klausler [Sat, 19 Jan 2019 22:38:31 +0000 (14:38 -0800)]
[flang] Enable building f18 as shared libraries
Original-commit: flang-compiler/f18@
4544d75af1b45e4c554a35327461311cff974884
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
peter klausler [Fri, 18 Jan 2019 23:53:11 +0000 (15:53 -0800)]
[flang] Rearrange code to eliminate dependence cycles between f18 library binaries
Original-commit: flang-compiler/f18@
88651eecae9cf7d5ea698eabcb315b3f2f169485
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
peter klausler [Fri, 18 Jan 2019 20:40:47 +0000 (12:40 -0800)]
[flang] Move default intrinsic type kinds from lib/semantics to lib/common
Original-commit: flang-compiler/f18@
887e72dd613f411808d1b9e9e7b64601a3b67af8
Reviewed-on: https://github.com/flang-compiler/f18/pull/265
Tree-same-pre-rewrite: false
Peter Klausler [Wed, 23 Jan 2019 00:24:58 +0000 (16:24 -0800)]
[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@
f21c9427fcc8024c30ec70d0a2eb8926ad1bbe50
Reviewed-on: https://github.com/flang-compiler/f18/pull/266
peter klausler [Tue, 22 Jan 2019 19:13:44 +0000 (11:13 -0800)]
[flang] Make x86 fp behavior emulation conditional.
Original-commit: flang-compiler/f18@
0c77a634b328b310206ccb00d7f40fcc9178f121
Reviewed-on: https://github.com/flang-compiler/f18/pull/266
Peter Klausler [Tue, 22 Jan 2019 17:59:29 +0000 (09:59 -0800)]
[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@
e2117d367bc616f32639f1551db5f32fa5f6b49e
Reviewed-on: https://github.com/flang-compiler/f18/pull/264
peter klausler [Fri, 18 Jan 2019 19:47:16 +0000 (11:47 -0800)]
[flang] Fix crash reported by Jean in error recovery case
Original-commit: flang-compiler/f18@
33db1790be41cb7e905d4bd0acf90222ddaf27e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/264
Peter Klausler [Fri, 18 Jan 2019 20:03:38 +0000 (12:03 -0800)]
[flang] Merge pull request flang-compiler/f18#260 from flang-compiler/pmk2
Complete parameterized derived type instantiation
Original-commit: flang-compiler/f18@
3ecceb30d7e408116078fa9c9c7a95ff810f4ba8
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
peter klausler [Fri, 18 Jan 2019 18:45:07 +0000 (10:45 -0800)]
[flang] fix clang build warning
Original-commit: flang-compiler/f18@
799fe63779206c19a9717e84678546f592d3218c
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
peter klausler [Fri, 18 Jan 2019 00:14:36 +0000 (16:14 -0800)]
[flang] done with merge
Original-commit: flang-compiler/f18@
9c63eb7a1a87bcd075938b4ec93a45ef5bd4c1bf
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
peter klausler [Thu, 17 Jan 2019 21:52:10 +0000 (13:52 -0800)]
[flang] merge with master, implement a TODO with LEN on ASSOCIATE
Original-commit: flang-compiler/f18@
e4501c6fa4e9819dd34c58f6d462c1482ea2332e
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
peter klausler [Tue, 4 Dec 2018 18:55:32 +0000 (10:55 -0800)]
[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@
1f43d0a04813dc02909e9952ee479d13f630df4c
Reviewed-on: https://github.com/flang-compiler/f18/pull/260
Tree-same-pre-rewrite: false
Tim Keith [Thu, 17 Jan 2019 01:29:07 +0000 (17:29 -0800)]
[flang] Merge pull request flang-compiler/f18#262 from flang-compiler/tsk4
Fix link error from last integration
Original-commit: flang-compiler/f18@
2d8c0f3e08128f3bde3892dd8e508a8798eda377
Reviewed-on: https://github.com/flang-compiler/f18/pull/262
Tim Keith [Thu, 17 Jan 2019 01:18:10 +0000 (17:18 -0800)]
[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@
9848a5d48f61f969f11814749c517990f76f6b04
Reviewed-on: https://github.com/flang-compiler/f18/pull/262
Tim Keith [Wed, 16 Jan 2019 23:31:45 +0000 (15:31 -0800)]
[flang] Merge pull request flang-compiler/f18#261 from flang-compiler/tsk2
Resolve names in ASSOCIATE and SELECT TYPE
Original-commit: flang-compiler/f18@
2e6932fb4a275f75485fbf648abd751b8002fa90
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
Tim Keith [Wed, 16 Jan 2019 21:21:15 +0000 (13:21 -0800)]
[flang] Fix typo
Original-commit: flang-compiler/f18@
27af745986699f6859580285dffedb917afe3a0b
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
Tim Keith [Wed, 16 Jan 2019 00:59:20 +0000 (16:59 -0800)]
[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@
b7668cebe49a122ea23c89c81eafdeba243bbfaf
Reviewed-on: https://github.com/flang-compiler/f18/pull/261
Tree-same-pre-rewrite: false
Eric Schweitz [Fri, 11 Jan 2019 00:13:40 +0000 (16:13 -0800)]
[flang] Merge pull request flang-compiler/f18#259 from flang-compiler/eas2
Eas2
Original-commit: flang-compiler/f18@
15fed726326d226ebe2031a1ff3854b8a069251e
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Eric Schweitz [Thu, 10 Jan 2019 20:13:45 +0000 (12:13 -0800)]
[flang] changes per review comments
Original-commit: flang-compiler/f18@
8a3b5b595339e18634e870f42f5cd053187f89e0
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Eric Schweitz [Thu, 10 Jan 2019 18:34:02 +0000 (10:34 -0800)]
[flang] Fix typos on superscripts.
Original-commit: flang-compiler/f18@
c9755c28f06535a5f8fd78ff4a29b1d0a1ee7604
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Tree-same-pre-rewrite: false
Eric Schweitz [Thu, 10 Jan 2019 18:28:56 +0000 (10:28 -0800)]
[flang] Add the Fortran IR document.
Original-commit: flang-compiler/f18@
35a8c66e13d4e6f54fc7ead085ca7258f0a90099
Reviewed-on: https://github.com/flang-compiler/f18/pull/259
Tree-same-pre-rewrite: false
Peter Klausler [Thu, 10 Jan 2019 00:46:35 +0000 (16:46 -0800)]
[flang] Merge pull request flang-compiler/f18#258 from flang-compiler/pmk1
cherrypick expression changes
Original-commit: flang-compiler/f18@
470b03caee0faba437202648054a23642ea1b25d
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
peter klausler [Thu, 10 Jan 2019 00:39:58 +0000 (16:39 -0800)]
[flang] address review comments
Original-commit: flang-compiler/f18@
e770e52cb10d895f082d9991a756199dd1fd1e0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
peter klausler [Wed, 9 Jan 2019 23:13:23 +0000 (15:13 -0800)]
[flang] remove debugging output
Original-commit: flang-compiler/f18@
3a156953c211591cdda31b3eb8cc1fe40d18b84b
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
Tree-same-pre-rewrite: false
peter klausler [Wed, 9 Jan 2019 23:06:07 +0000 (15:06 -0800)]
[flang] cherrypick expression changes
Original-commit: flang-compiler/f18@
427e267722b01af6b0bc8b41a224d49334382a1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/258
Tree-same-pre-rewrite: false
Tim Keith [Tue, 8 Jan 2019 22:21:28 +0000 (14:21 -0800)]
[flang] Merge pull request flang-compiler/f18#256 from flang-compiler/tsk6
More name resolution
Original-commit: flang-compiler/f18@
3ea1c3bf4c596a3e3c4eb42189148bd0c58b54ab
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tim Keith [Mon, 7 Jan 2019 21:31:50 +0000 (13:31 -0800)]
[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@
65ae81ebacbe75094d7ec7d83ae3a0f35eb591d2
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tim Keith [Mon, 7 Jan 2019 19:28:20 +0000 (11:28 -0800)]
[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@
3bdbfc34bb75e6585eea57aa3240c3c825fff704
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tree-same-pre-rewrite: false
Tim Keith [Mon, 7 Jan 2019 18:10:15 +0000 (10:10 -0800)]
[flang] Bug fix: pass right value as MiscDetails::Kind
Original-commit: flang-compiler/f18@
94d63399bdf5409d59107f6681905f60dfe2b639
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tree-same-pre-rewrite: false
Tim Keith [Sat, 5 Jan 2019 01:10:31 +0000 (17:10 -0800)]
[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@
404c920840880bf63bb3b0984cb0e1213057d619
Reviewed-on: https://github.com/flang-compiler/f18/pull/256
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 8 Jan 2019 19:32:51 +0000 (11:32 -0800)]
[flang] Merge pull request flang-compiler/f18#248 from pjh40/pjh2
Define non-inline versions of ExpressionBase::derived()
Original-commit: flang-compiler/f18@
f78bba7490417d0db547007ea2db990c46434936
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
Paul Henning [Thu, 3 Jan 2019 16:45:27 +0000 (09:45 -0700)]
[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@
b38b31909a4d30e3cfd77353d44ecff06ef425da
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
Paul Henning [Thu, 20 Dec 2018 17:39:29 +0000 (10:39 -0700)]
[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@
074de39418299e7e53b437adfbbc381004e0886e
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
Tree-same-pre-rewrite: false
Peter Klausler [Tue, 8 Jan 2019 18:50:12 +0000 (10:50 -0800)]
[flang] Merge pull request flang-compiler/f18#255 from flang-compiler/pmk1
Minor clean-up after a merge
Original-commit: flang-compiler/f18@
4bd4a2045fbe4a12d69543ba23d59cf12f52e89b
Reviewed-on: https://github.com/flang-compiler/f18/pull/255