Commit graph

473 commits

Author SHA1 Message Date
peter klausler
f2cb0a8015 [flang] Move leading zero bit count into lib/common
Original-commit: flang-compiler/f18@1ed184febe
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:11 -07:00
Jean Perier
281d41cc10 [flang] Use value semantic for SourceName
Change all SourceName* to std::optional<SourceName> because
SourceName is small enough (16 bytes) to be passed and stored
by value which avoid having to worry about life-time, storage and
value constance issues that comes with pointers.

Original-commit: flang-compiler/f18@73fc08d7bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/634
Tree-same-pre-rewrite: false
2019-08-21 05:33:03 -07:00
peter klausler
10688e0903 [flang] Enable more warnings, deal with fallout
Original-commit: flang-compiler/f18@65c5b485af
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:07 -07:00
peter klausler
e8c453f4ae [flang] Clean up all newly enabled warnings
Original-commit: flang-compiler/f18@34a917c761
Reviewed-on: https://github.com/flang-compiler/f18/pull/666
Tree-same-pre-rewrite: false
2019-08-16 09:41:07 -07:00
Steve Scalpone
0653dab8de [flang] Add dcmplx to the intrinsic table and extensions documentation.
Formatting change to dimag intrinsic table entry.

Original-commit: flang-compiler/f18@7f9237531c
Reviewed-on: https://github.com/flang-compiler/f18/pull/662
2019-08-14 11:32:32 -07:00
Steve Scalpone
465393f40f [flang] Add an entry to the intrinsics table for dimag.
Also, document extensions dconjg and dimag.

Original-commit: flang-compiler/f18@21535280ee
Reviewed-on: https://github.com/flang-compiler/f18/pull/654
2019-08-13 07:36:22 -07:00
Tim Keith
d151b5e88b [flang] Fix bug writing character array constructor to .mod file
Character literals in an array constructor were always written
with no kind prefix, so if kind was not 1 they were incorrect.
`c4a` in `modfile28.f90` was an example of this.

Change it to always include the kind as is done with non-array
character literals.

Original-commit: flang-compiler/f18@4f4caa7006
Reviewed-on: https://github.com/flang-compiler/f18/pull/650
2019-08-13 09:15:50 -07:00
peter klausler
cbb0be6a37 [flang] Fix bug flang-compiler/f18#643
Original-commit: flang-compiler/f18@29bb4312e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/646
2019-08-12 10:56:18 -07:00
peter klausler
c9d286d6c4 [flang] Restore symbol to ProcBindingDetails
Original-commit: flang-compiler/f18@5dc1c91156
Reviewed-on: https://github.com/flang-compiler/f18/pull/638
Tree-same-pre-rewrite: false
2019-08-09 09:41:50 -07:00
Tim Keith
331c04cce6 [flang] Change ArraySpec from a type alias to a class
This allows it to have member functions `Rank()`, `IsExplicitShape()`,
`IsAssumedShape()`, etc. Make use of those new functions and remove
`isExplicit()` and `isDeferred()` from `ShapeSpec` as they are no
longer needed.

Original-commit: flang-compiler/f18@7ef7ad6359
Reviewed-on: https://github.com/flang-compiler/f18/pull/630
Tree-same-pre-rewrite: false
2019-08-07 10:51:07 -07:00
peter klausler
58ea24d3e3 [flang] Dodge two bogus warnings from g++ 8.1
Original-commit: flang-compiler/f18@aa19aeb92a
Reviewed-on: https://github.com/flang-compiler/f18/pull/633
2019-08-07 09:18:20 -07:00
Jean Perier
ba7ed2722a [flang] Fix extended derived type kind compatibility check
`HaveCompatibleKindParameters` was not considering the kind
parameters of the parent types leading to false answers.
This change fixes this by directly looking into the map of `ParamValue`
of the `DeclTypeSpec` instead of going through the symbols of the derived
type scope. This map contains all the parent and implicit type parameters.

Original-commit: flang-compiler/f18@cd5b976fc9
Reviewed-on: https://github.com/flang-compiler/f18/pull/615
Tree-same-pre-rewrite: false
2019-08-06 04:46:18 -07:00
peter klausler
bef468fbfd [flang] Remove obsolete code
Original-commit: flang-compiler/f18@81a97453a8
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
2019-08-05 12:47:43 -07:00
peter klausler
58f93ac714 [flang] Fold SIGN()
Original-commit: flang-compiler/f18@521a02ad51
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
2019-08-05 12:44:36 -07:00
peter klausler
adf204a50e [flang] Fold DIGITS
Original-commit: flang-compiler/f18@6c9adff7a6
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
2019-08-05 10:46:54 -07:00
peter klausler
97848749fa [flang] Add DIGITS to intrinsic function table; fix results of some others
Original-commit: flang-compiler/f18@6d5caef352
Reviewed-on: https://github.com/flang-compiler/f18/pull/623
Tree-same-pre-rewrite: false
2019-08-05 09:42:06 -07:00
peter klausler
c940fb6641 [flang] Fix test failure, clean up for merging
Original-commit: flang-compiler/f18@77bad27366
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
2019-08-02 10:17:10 -07:00
peter klausler
61fdf0a93e [flang] Take suggestion from review comment
Original-commit: flang-compiler/f18@7616b1f71b
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:12 -07:00
peter klausler
ca57deed00 [flang] Address review comment re: ALLOCATED intrinsic argument
Original-commit: flang-compiler/f18@b24381c7df
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:11 -07:00
peter klausler
25ff9296e0 [flang] Fix LBOUND/UBOUND of associated expr, add test
Original-commit: flang-compiler/f18@009095a9bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:11 -07:00
peter klausler
6df445d0e7 [flang] Fix LBOUND & UBOUND(function()), add tests
Original-commit: flang-compiler/f18@1e093e9927
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:10 -07:00
peter klausler
63423667fe [flang] Clean up some usage of std::optional lambda results
Original-commit: flang-compiler/f18@9a66f9da97
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:09 -07:00
peter klausler
29d3343910 [flang] Extract LBOUND/UBOUND folding into their own functions
Original-commit: flang-compiler/f18@bf9146ad77
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:06 -07:00
peter klausler
16f94adf9b [flang] Address some review comments, fix crash
Original-commit: flang-compiler/f18@7b7579eb5a
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:04 -07:00
peter klausler
2ca6f8220c [flang] Handle association entities; fix problems found in testing
Original-commit: flang-compiler/f18@c4d9fe9587
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:03 -07:00
peter klausler
43b3e49490 [flang] Fold LBOUND and UBOUND; do not insert empty triplets into whole array expressions
Original-commit: flang-compiler/f18@82fba68a66
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:22:00 -07:00
peter klausler
a7041f3a78 [flang] Implement GetShape with expression visitor
Original-commit: flang-compiler/f18@d607d02847
Reviewed-on: https://github.com/flang-compiler/f18/pull/611
Tree-same-pre-rewrite: false
2019-08-02 09:21:59 -07:00
peter klausler
6347b7c695 [flang] Fix bug
Original-commit: flang-compiler/f18@482f882e3f
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
2019-07-25 10:40:09 -07:00
peter klausler
5eebbe7c9b [flang] Fix IsVariable for Pete
Original-commit: flang-compiler/f18@4a24f74ae4
Reviewed-on: https://github.com/flang-compiler/f18/pull/603
Tree-same-pre-rewrite: false
2019-07-25 10:40:07 -07:00
peter klausler
4aa659f795 [flang] Address comments; allow "real,parameter::x=tiny(x)"
Original-commit: flang-compiler/f18@e865358871
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
2019-07-25 10:16:28 -07:00
peter klausler
9b079deed5 [flang] Fold more model inquiry intrinsics
Original-commit: flang-compiler/f18@a3d82893b7
Reviewed-on: https://github.com/flang-compiler/f18/pull/602
Tree-same-pre-rewrite: false
2019-07-24 14:07:03 -07:00
peter klausler
353202bdcf [flang] Fix handling of ALLOCATABLE components in GetLastTarget
Original-commit: flang-compiler/f18@6b3b404bdc
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 13:42:06 -07:00
peter klausler
00861127ac [flang] Improve comments
Original-commit: flang-compiler/f18@277fb1cc91
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 11:45:55 -07:00
peter klausler
e4945e5d09 [flang] Improve expression traversal, use it more for tools
Original-commit: flang-compiler/f18@4980b928bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-23 10:55:56 -07:00
peter klausler
3028ecf0b8 [flang] Reimplement GetLastSymbol with expression visitor
Original-commit: flang-compiler/f18@a996751e97
Reviewed-on: https://github.com/flang-compiler/f18/pull/601
Tree-same-pre-rewrite: false
2019-07-22 14:05:33 -07:00
jeanPerier
953d93dbe8 [flang] Merge pull request flang-compiler/f18#544 from flang-compiler/jpr-reshape-only-folding
RESHAPE without shared runtime/front-end descriptor API

Original-commit: flang-compiler/f18@24856b8238
Reviewed-on: https://github.com/flang-compiler/f18/pull/544

Due to a conflicting rebase during the linearizing of flang-compiler/f18, this commit squashes a number of other commits:

flang-compiler/f18@2ec1d85d39 Implement RESHAPE folding on Constant<T> only
flang-compiler/f18@5394630539 Enable RESHAPE folding tests
flang-compiler/f18@83b2b86253 Answer review comment + Add a common path for intrsinic function folding before specializing the folding per type. + Make reshape folding return an "invalid" intrinsic after errors are met so that warnings do not get re-generated. + Misc style changes
flang-compiler/f18@2e5c29f280 add missing file to previous commit...
flang-compiler/f18@9bd5ad9875 Document issue #518 workaround
flang-compiler/f18@a4f8f51831 Go back to clang-format version 7.01
flang-compiler/f18@e871e58a52 answer comment regarding naming and interface
flang-compiler/f18@145c7c1ece Merge branch 'master' into jpr-reshape-only-folding Too many logical conflicts to simply rebase.
2019-07-23 05:36:17 -07:00
peter klausler
31ffd34a02 [flang] Avoid crash on bad subscript, refactor Constant bounds a bit
Original-commit: flang-compiler/f18@c2e01e8386
Reviewed-on: https://github.com/flang-compiler/f18/pull/597
2019-07-19 16:17:07 -07:00
peter klausler
645d98719d [flang] address review comment
Original-commit: flang-compiler/f18@7012b61786
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
2019-07-19 10:37:55 -07:00
peter klausler
85db492ea0 [flang] Support SELECTED_CHAR_KIND("DEFAULT")
Original-commit: flang-compiler/f18@c05c96c474
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 15:58:28 -07:00
peter klausler
3dbc1b7abe [flang] Allow BOZ initializers on REAL parameters, too.
Original-commit: flang-compiler/f18@e1ab6b316e
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 14:26:35 -07:00
peter klausler
8187bc12cd [flang] Silence spurious overflow warning on negative int4->int2 folding
Original-commit: flang-compiler/f18@5f1cad3911
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 14:14:09 -07:00
peter klausler
2a3f3163e6 [flang] Extension: relax "same kind" rules on some intrinsics
Original-commit: flang-compiler/f18@ce5130f84b
Reviewed-on: https://github.com/flang-compiler/f18/pull/590
Tree-same-pre-rewrite: false
2019-07-17 12:51:52 -07:00
peter klausler
8c0aa90185 [flang] Handle USE and host associations in characteristics analysis
Original-commit: flang-compiler/f18@1625f72e35
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:51 -07:00
peter klausler
29004ece95 [flang] fix crash in ASSOCIATED() intrinsic with two arguments
Original-commit: flang-compiler/f18@1a393ff43b
Reviewed-on: https://github.com/flang-compiler/f18/pull/565
Tree-same-pre-rewrite: false
2019-07-16 09:58:48 -07:00
Tim Keith
97e60b7354 [flang] Procedure distinguishability rules for operators
Generic operators and assignment have different rules than generic
names for their procedures being distinguishable.

Implement those rules in `DistinguishableOpOrAssign`. The rules are
considerably simpler: they must have the name number of dummy arguments
and at least one pair in the same position must be distinguishable.

Fixes issue flang-compiler/f18#563.

Original-commit: flang-compiler/f18@276bb08206
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
2019-07-15 13:05:42 -07:00
Tim Keith
714d3be8bf [flang] Use passed-object dummy in distinguishability checks
Complete the checks for distinguishable specifics procedure in a generic
by considering any passed-object dummy arguments.

C1514 rule 3 is implemented and the checks for the other rules are
extended to consider the PASS attribute, including the concept of the
"effective" position of an argument in an argument list, computed by
ignoring passed-object arguments.

Add `pass` to `characteristics::DummyArgument` to mark each
passed-object dummy argument.

Change symbols to store the index of the passed-object dummy argument
rather than its symbol.

Check that specifics of a type-bound generic are distinguishable only
after all of the procedure bindings have been processed. They don't have
to be before the generic.

Original-commit: flang-compiler/f18@2751490f95
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
2019-07-12 12:18:00 -07:00
peter klausler
20dd13e492 [flang] Better name resolution for intrinsics
Original-commit: flang-compiler/f18@31fd9c82e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/561
2019-07-11 11:52:47 -07:00
peter klausler
8ccd6b19c4 [flang] Allow BOZ argument to more intrinsics; generalize BOZ conversions in folding
Original-commit: flang-compiler/f18@6df0136ee8
Reviewed-on: https://github.com/flang-compiler/f18/pull/557
Tree-same-pre-rewrite: false
2019-07-10 16:42:06 -07:00
peter klausler
008e697192 [flang] Fix regressions found in testing
Original-commit: flang-compiler/f18@ea09b191df
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
2019-07-08 16:02:50 -07:00
peter klausler
7a6dabf974 [flang] Resolve merge
Original-commit: flang-compiler/f18@44743f1fa9
Reviewed-on: https://github.com/flang-compiler/f18/pull/553
Tree-same-pre-rewrite: false
2019-07-08 10:44:43 -07:00