Commit graph

2973 commits

Author SHA1 Message Date
peter klausler 39114d503a [flang] Another attempt to fix bug flang-compiler/f18#877
Original-commit: flang-compiler/f18@2ad2330cda
Reviewed-on: https://github.com/flang-compiler/f18/pull/906
2020-01-03 15:08:37 -08:00
Tim Keith 0922083181 [flang] Merge pull request flang-compiler/f18#904 from flang-compiler/tsk-assignment3
Add analyzed form of pointer assignment

Original-commit: flang-compiler/f18@1f6cc18c7c
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
2020-01-03 14:11:14 -08:00
Tim Keith d42aaa81f2 [flang] Add analyzed form of pointer assignment
Add `typedAssignment` to `PointerAssignmentStmt` parse tree node and
extend `evaluate::Assignment` to include pointer assignment, including
analyzed bounds. Analyze pointer assignments and fill those in.
Emit them in unparsed output and parse tree dump when present.

Change assignment checking to use analyzed expressions and assignments
rather than calling AnalyzeExpr. Check bounds in pointer assignments
for impure function calls in FORALL context.

Add `Fold` convenience function to `ExpressionAnalyzer`.

Original-commit: flang-compiler/f18@140c983423
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
2020-01-03 14:10:26 -08:00
Tim Keith b58617b940 [flang] Use common SymbolSet type
Replace `std::set<const Symbol *>` with `SymbolSet` from `symbol.h`.

Original-commit: flang-compiler/f18@78e3ff33cc
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
Tree-same-pre-rewrite: false
2020-01-03 14:09:47 -08:00
Tim Keith ec88d6780f [flang] Fix type resolution in ConcurrentHeader
As it was implemented we weren't detecting non-constant kind parameters
in the integer-type-spec. The fix is just to walk the integer-type-spec
like was do any other one.

Also, there is not need for ResolveControlExpressions -- all it does is
walk that part of the parse tree.

Original-commit: flang-compiler/f18@8c0d890eb8
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
Tree-same-pre-rewrite: false
2020-01-03 14:09:47 -08:00
Tim Keith 83d574bf07 [flang] Move forall01 to ERROR_TESTS
That seems to be what was intended and it provides for better checking
of errors.

Original-commit: flang-compiler/f18@99376d77a0
Reviewed-on: https://github.com/flang-compiler/f18/pull/904
Tree-same-pre-rewrite: false
2020-01-03 14:09:42 -08:00
Peter Klausler 833bce4e94 [flang] Merge pull request flang-compiler/f18#903 from flang-compiler/pmk-fix
Remove needless std::move() that breaks clang build

Original-commit: flang-compiler/f18@85f5cbecf1
Reviewed-on: https://github.com/flang-compiler/f18/pull/903
2020-01-03 11:33:12 -08:00
peter klausler 2e32cadddd [flang] Remove needless std::move() that breaks clang build
Add the std::move() to where it should have been

Original-commit: flang-compiler/f18@54fe9b39a1
Reviewed-on: https://github.com/flang-compiler/f18/pull/903
2020-01-03 11:32:44 -08:00
psteinfeld 004b8417d4 [flang] Merge pull request flang-compiler/f18#902 from flang-compiler/ps-do-call
Check for passing DO variables to OUT arguments in a CALL statement

Original-commit: flang-compiler/f18@27220661c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/902
2020-01-03 09:09:02 -08:00
Pete Steinfeld d32d669651 [flang] Check for passing DO variables to OUT arguments in a CALL statement
I added code to save the INTENT of a dummy argument in the checked expression
of the actual argument.  When processing a CallStmt, I then retrieve the
ProcedureRef, which contains a list of the checked ActualArguments.  I then
traverse this list looking for actual arguments that are active DO variable
that are being passed to dummy arguments whose INTENT is either OUT or INOUT.
For OUT dummies, I put out an error message and warn for INOUT dummies.

Original-commit: flang-compiler/f18@0ff1d26428
Reviewed-on: https://github.com/flang-compiler/f18/pull/902
2020-01-03 08:53:42 -08:00
Peter Klausler a8ce0fcc1e [flang] Merge pull request flang-compiler/f18#901 from flang-compiler/pmk-operator-tbp
Fix type-bound user-defined operators

Original-commit: flang-compiler/f18@db63c87fb0
Reviewed-on: https://github.com/flang-compiler/f18/pull/901
2020-01-02 12:27:12 -08:00
peter klausler 9948f910a5 [flang] Handle type-bound user-defined operators
Pre-review clean-up

Original-commit: flang-compiler/f18@1d4e85563a
Reviewed-on: https://github.com/flang-compiler/f18/pull/901
2020-01-02 11:49:55 -08:00
Tim Keith 0bea8c9d6b [flang] Merge pull request flang-compiler/f18#899 from flang-compiler/deps
Add .mod file dependencies

Original-commit: flang-compiler/f18@74617f1d48
Reviewed-on: https://github.com/flang-compiler/f18/pull/899
2020-01-02 08:29:19 -08:00
Tim Keith 96ce00bba2 [flang] Add .mod file dependencies
Make compilation of other predefined module files depend on
__fortran_builtins.mod. Currently only iso_c_binding.f90 and
iso_fortran_env.f90 depend on it but others could in the future.

Create the .f18.mod files by copying from the .mod files so that
we don't have to worry about dependencies for those.

Original-commit: flang-compiler/f18@8209ad3d32
Reviewed-on: https://github.com/flang-compiler/f18/pull/899
2019-12-31 14:08:12 -08:00
Peter Klausler 20a9a8154d [flang] Merge pull request flang-compiler/f18#900 from flang-compiler/pmk-fold
Partition fold.cc to reduce build-time memory requirements

Original-commit: flang-compiler/f18@372c82219a
Reviewed-on: https://github.com/flang-compiler/f18/pull/900
2019-12-31 15:25:47 -08:00
peter klausler c587f89a3c [flang] Prep for review
Original-commit: flang-compiler/f18@25cb92e990
Reviewed-on: https://github.com/flang-compiler/f18/pull/900
2019-12-31 14:10:28 -08:00
peter klausler ceb8196023 [flang] Put templates back into implementation header
Original-commit: flang-compiler/f18@8949924351
Reviewed-on: https://github.com/flang-compiler/f18/pull/900
Tree-same-pre-rewrite: false
2019-12-31 13:58:26 -08:00
peter klausler 8deb4bbeb7 [flang] More restructuring
Original-commit: flang-compiler/f18@6e4aca113a
Reviewed-on: https://github.com/flang-compiler/f18/pull/900
Tree-same-pre-rewrite: false
2019-12-31 13:43:15 -08:00
peter klausler d64886d01b [flang] Break up fold.cc along per-type fault lines
Original-commit: flang-compiler/f18@8022c143d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/900
Tree-same-pre-rewrite: false
2019-12-31 12:20:42 -08:00
peter klausler add998bec1 [flang] Make SHAPE= argument to C_F_POINTER() sensitive to -Mlargearray
Original-commit: flang-compiler/f18@daaa74bbc8
Reviewed-on: https://github.com/flang-compiler/f18/pull/900
Tree-same-pre-rewrite: false
2019-12-31 11:06:07 -08:00
Peter Klausler dd04f72b2b [flang] Merge pull request flang-compiler/f18#898 from flang-compiler/pmk-patch
Patch build problem

Original-commit: flang-compiler/f18@07318b5c89
Reviewed-on: https://github.com/flang-compiler/f18/pull/898
2019-12-31 10:52:56 -08:00
peter klausler ec833a6bb7 [flang] Patch build problem
Original-commit: flang-compiler/f18@a668512100
Reviewed-on: https://github.com/flang-compiler/f18/pull/898
2019-12-31 09:19:08 -08:00
Peter Klausler 15d285a63a [flang] Merge pull request flang-compiler/f18#896 from flang-compiler/pmk-c_f_pointer
C_F_POINTER

Original-commit: flang-compiler/f18@f4d48e8525
Reviewed-on: https://github.com/flang-compiler/f18/pull/896
2019-12-31 08:53:40 -08:00
peter klausler 663db2741d [flang] C_F_POINTER
Emit INTRINSIC statements in module files

Argument checking utility

Complete error checking

Original-commit: flang-compiler/f18@9c6a88f048
Reviewed-on: https://github.com/flang-compiler/f18/pull/896
2019-12-31 08:34:53 -08:00
Peter Klausler 0e5c4272ea [flang] Merge pull request flang-compiler/f18#893 from flang-compiler/pmk-fixes
Fix flang-compiler/f18#892 and a crash

Original-commit: flang-compiler/f18@86ae6e6cc8
Reviewed-on: https://github.com/flang-compiler/f18/pull/893
2019-12-24 18:08:03 -08:00
peter klausler b8a7bad3e0 [flang] Fix test for assignment to host-associated object in PURE
Original-commit: flang-compiler/f18@019e61aa85
Reviewed-on: https://github.com/flang-compiler/f18/pull/893
2019-12-24 17:53:01 -08:00
Steve Scalpone 71f6a80c2b [flang] The #! sequence must be at the start of the script file. (flang-compiler/f18#894)
Original-commit: flang-compiler/f18@b1ff232730
Reviewed-on: https://github.com/flang-compiler/f18/pull/894
2019-12-24 16:58:28 -08:00
psteinfeld 24b3d0adc6 [flang] Merge pull request flang-compiler/f18#860 from flang-compiler/ps-do-redefine
Semantic checks to see if a DO variable is modified

Original-commit: flang-compiler/f18@6715b162fa
Reviewed-on: https://github.com/flang-compiler/f18/pull/860
2019-12-24 15:19:01 -08:00
Pete Steinfeld 611db270f6 [flang] Semantic checks to see if a DO variable is modified
I added infrastructure to SemanticsContext to track active DO variables
and the source locations where they appear in DO statements.  I also
added code to semantics.[h,cc] to check to see if a DO variable is
already defined, and, if so, to emit an error message along with a
reference to the relevant DO construct.  I also added calls to several
places where variables are defined to determine if the definitions are
happening in the context of an active DO construct.

I have not yet added the checks for DO variables being redefined when passing
them as actual arguments to dummy arguments with INTENT(OUT) or INTENT(INOUT).
I wanted to get these changes merged first and catch up with the other changes
in master.

Original-commit: flang-compiler/f18@1bbfcca61b
Reviewed-on: https://github.com/flang-compiler/f18/pull/860
2019-12-24 15:16:36 -08:00
Peter Klausler 17fdc5cc63 [flang] Merge pull request flang-compiler/f18#891 from flang-compiler/pmk-spec
Some fixes

Original-commit: flang-compiler/f18@e3ee4a658a
Reviewed-on: https://github.com/flang-compiler/f18/pull/891
2019-12-23 16:35:54 -08:00
peter klausler 16c5b86368 [flang] Fix off-by-one error in preprocessing expressions
Original-commit: flang-compiler/f18@4c08a4a1be
Reviewed-on: https://github.com/flang-compiler/f18/pull/891
2019-12-23 16:18:21 -08:00
Gary Klimowicz f8393113f2 [flang] Merge pull request flang-compiler/f18#890 from flang-compiler/gak-format-fixes
Fix clang-format issues identified during relicensing

Original-commit: flang-compiler/f18@a04295dc36
Reviewed-on: https://github.com/flang-compiler/f18/pull/890
2019-12-23 11:47:55 -08:00
Gary Klimowicz a0caa6af36 [flang] Fix clang-format issues identified during relicensing
While running clang-format during the relicensing, there were
a few files that showed minor format issues that could be cleaned
up. These changes address them.

Original-commit: flang-compiler/f18@b308f9e35a
Reviewed-on: https://github.com/flang-compiler/f18/pull/890
2019-12-23 11:16:00 -08:00
Gary Klimowicz 6ba7d300aa [flang] Merge pull request flang-compiler/f18#887 from flang-compiler/gak-relicense
Flang relicensing changes for LLVM Apache 2.0 license

Original-commit: flang-compiler/f18@e06be2faa6
Reviewed-on: https://github.com/flang-compiler/f18/pull/887
2019-12-23 11:07:30 -08:00
Gary Klimowicz 9e7548ab31 [flang] Flang relicensing changes for LLVM Apache 2.0 license
This changes the license information in many of the flang source files.
- Renamed LICENSE to LICENSE.txt.
- NVIDIA Copyright lines have been removed.
- Initial lines for files follow the LLVM coding convention (file name on the first line; Emacs mode information on the first line).
- License references have been replaced with the abridged LLVM text.
- License information was removed from the test files.
- No file header was placed on test files (these weren't in most LLVM test files).
- License information was added to documentation files where it was missing.

We did not add brief file summaries to the initial line.

See http://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
for a description of the new license.

See http://llvm.org/docs/CodingStandards.html#file-headers
for a description of the new LLVM standard file header.

Original-commit: flang-compiler/f18@add6cde724
Reviewed-on: https://github.com/flang-compiler/f18/pull/887
2019-12-23 10:26:16 -08:00
Peter Klausler 317c3fa860 [flang] Merge pull request flang-compiler/f18#886 from kiranchandramohan/elemental
Mark ieee_get_flag and ieee_get_halting_mode as elemental

Original-commit: flang-compiler/f18@a694b62c6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/886
2019-12-20 12:53:06 -08:00
Kiran Chandramohan 69d01593b4 [flang] Mark ieee_get_flag and ieee_get_halting_mode as elemental
Original-commit: flang-compiler/f18@d6237fa311
Reviewed-on: https://github.com/flang-compiler/f18/pull/886
2019-12-20 20:28:45 +00:00
Peter Klausler c1ccbcf913 [flang] Merge pull request flang-compiler/f18#885 from flang-compiler/pmk-fixes
Two small fixes

Original-commit: flang-compiler/f18@2d8a4815a3
Reviewed-on: https://github.com/flang-compiler/f18/pull/885
2019-12-20 12:24:30 -08:00
peter klausler d67fbce92b [flang] Fix kind of REAL(complex) to be the same as the argument by default
Fixes for expression formatting

Original-commit: flang-compiler/f18@13e8909587
Reviewed-on: https://github.com/flang-compiler/f18/pull/885
2019-12-20 12:06:03 -08:00
Peter Klausler 8db76ec779 [flang] Merge pull request flang-compiler/f18#884 from flang-compiler/pmk-warn-size
Convert INTEGER scalar actual argument expressions to the kinds of dummies

Original-commit: flang-compiler/f18@c88694b36e
Reviewed-on: https://github.com/flang-compiler/f18/pull/884
2019-12-20 10:09:49 -08:00
peter klausler 3a725ca8d0 [flang] Auto conversion of integer scalar actual argument exprs
Add documentation

Original-commit: flang-compiler/f18@c1b200d238
Reviewed-on: https://github.com/flang-compiler/f18/pull/884
2019-12-20 10:01:49 -08:00
Peter Klausler d98d029b02 [flang] Merge pull request flang-compiler/f18#883 from flang-compiler/pmk-spec-fixes
Misc fixes from SPEC

Original-commit: flang-compiler/f18@9e91c635d7
Reviewed-on: https://github.com/flang-compiler/f18/pull/883
2019-12-19 18:35:17 -08:00
peter klausler 617a4cce50 [flang] Roll up fixes for semantic analysis of SPEC CPU codes
- Add cases to IsDescriptor
- Fix NULLIFY in PURE checking
- Fix fotonik3d mutually-referencing derived type bug
- Fix spurious I/O error message on ALLOCATE

Original-commit: flang-compiler/f18@34b64db7da
Reviewed-on: https://github.com/flang-compiler/f18/pull/883
2019-12-19 18:05:58 -08:00
Tim Keith 2e9633125e [flang] Save CallStmt::typedCall (flang-compiler/f18#879)
When `ExpressionAnalyzer::AnalyzeCall` processed a subroutine it was
always returning std::nullopt. Change it to return a `ProcedureRef`
wrapped in an `Expr` so that it can be saved in `CallStmt::typedCall`.

Original-commit: flang-compiler/f18@2cc226f66e
Reviewed-on: https://github.com/flang-compiler/f18/pull/879
2019-12-19 09:52:15 -08:00
Tim Keith b200b244f6 [flang] Merge pull request flang-compiler/f18#878 from flang-compiler/tsk-dump-parse-expr
Include analyzed exprs in parse tree dump

Original-commit: flang-compiler/f18@0855ba8baa
Reviewed-on: https://github.com/flang-compiler/f18/pull/878
2019-12-18 17:26:49 -08:00
Tim Keith c6aaa9875d [flang] Remove extraneous occurences of parser::
This file is in `Fortran::parser` so we don't need to qualify names
with `parser::`.

Original-commit: flang-compiler/f18@e8e7ffcae8
Reviewed-on: https://github.com/flang-compiler/f18/pull/878
2019-12-18 16:29:50 -08:00
Tim Keith 37de6803e3 [flang] Include analyzed exprs in parse tree dump
When dumping the parse tree, if there are analyzed expressions,
assignments, or call statements, include the Fortran form of those
in the dump.

This uses the same `AnalyzedObjectsAsFortran` object that unparsing
does so it applies to the same nodes.

We already do something like this for `Name` nodes as well as some
predefined types, so abstract it into an `AsFortran` function which
returns the Fortran source for a node that is to be included in the
dump.

Original-commit: flang-compiler/f18@823b044d2a
Reviewed-on: https://github.com/flang-compiler/f18/pull/878
Tree-same-pre-rewrite: false
2019-12-18 16:29:08 -08:00
Peter Klausler 47f6ebda61 [flang] Merge pull request flang-compiler/f18#874 from flang-compiler/pmk-fixes
Fix unparsing of assignment representation and excess parentheses

Original-commit: flang-compiler/f18@3e7e95fff2
Reviewed-on: https://github.com/flang-compiler/f18/pull/874
2019-12-18 16:11:31 -08:00
peter klausler e668139fdc [flang] Fix unparsing of assignment representation and excess parentheses
More fixes, and move prefix/infix/suffix strings into formatting.cc

Original-commit: flang-compiler/f18@49d68700e0
Reviewed-on: https://github.com/flang-compiler/f18/pull/874
2019-12-18 16:10:16 -08:00
Peter Klausler 37568d4d64 [flang] Merge pull request flang-compiler/f18#873 from flang-compiler/pmk-call
Save analyzed ProcedureRef in parse tree node for CALL statement

Original-commit: flang-compiler/f18@80c2705205
Reviewed-on: https://github.com/flang-compiler/f18/pull/873
2019-12-17 13:44:51 -08:00