Commit graph

2950 commits

Author SHA1 Message Date
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
peter klausler cfe146bfde [flang] Back some changes out
Original-commit: flang-compiler/f18@7f6345ac62
Reviewed-on: https://github.com/flang-compiler/f18/pull/873
2019-12-17 12:32:16 -08:00
peter klausler cd1d3881f1 [flang] Save analyzed CALL statements in the parse tree
Original-commit: flang-compiler/f18@bd618f179c
Reviewed-on: https://github.com/flang-compiler/f18/pull/873
Tree-same-pre-rewrite: false
2019-12-17 10:53:20 -08:00
Peter Klausler a318aee272 [flang] Merge pull request flang-compiler/f18#862 from flang-compiler/pmk-grammar
Outline parsers for types (reduce f18 build memory requirements)

Original-commit: flang-compiler/f18@8d2b296fe1
Reviewed-on: https://github.com/flang-compiler/f18/pull/862
2019-12-16 15:05:42 -08:00
peter klausler 828eed971b [flang] Improve commentary
Original-commit: flang-compiler/f18@364ac83bfc
Reviewed-on: https://github.com/flang-compiler/f18/pull/862
2019-12-16 14:28:57 -08:00
peter klausler 40f0e01d2d [flang] Outline per-type parsers to reduce f18 build-time
CPU & memory requirements

Original-commit: flang-compiler/f18@f48fe07dfa
Reviewed-on: https://github.com/flang-compiler/f18/pull/862
Tree-same-pre-rewrite: false
2019-12-16 12:55:41 -08:00
Tim Keith b738d4ad38 [flang] Merge pull request flang-compiler/f18#872 from flang-compiler/tsk-defined-op2
Support for type-bound operators and assignment

Original-commit: flang-compiler/f18@9862c94061
Reviewed-on: https://github.com/flang-compiler/f18/pull/872
2019-12-16 14:50:19 -08:00
Tim Keith ea00274e6d [flang] Add evaluate::GetDerivedTypeSpec(DynamicType)
It gets the semantics::DerivedTypeSpec of a DynamicType if it has one.
Make use of it where it simplifies the code.

Original-commit: flang-compiler/f18@9ad12e7c13
Reviewed-on: https://github.com/flang-compiler/f18/pull/872
2019-12-16 14:48:27 -08:00
Tim Keith 6e2e78a09e [flang] C774: Defined operator/assignment may not have NOPASS
Original-commit: flang-compiler/f18@6bfa3d3568
Reviewed-on: https://github.com/flang-compiler/f18/pull/872
Tree-same-pre-rewrite: false
2019-12-16 14:48:27 -08:00
Tim Keith e567bf9f5e [flang] Support for type-bound operators and assignment
Add `ArgumentAnalyzer::FindBoundOp` to look for an operator or
assignment definition in the type of each operand. Then `TryBoundOp`
checks if it is actually applicable.

Change ResolveGeneric to handle type-bound operators: the `adjustActuals`
function passed in handles the difference between these and normal
type-bound procedures. For operators, either operand may be the passed-
object argument. For procedures we know which one it is.

Extract `GetDerivedTypeSpec`, `GetBindingResolution`, and
`OkLogicalIntegerAssignment` into separate functions to simplify the
logic of the calling functions.

Original-commit: flang-compiler/f18@1f7ff22145
Reviewed-on: https://github.com/flang-compiler/f18/pull/872
Tree-same-pre-rewrite: false
2019-12-16 14:48:22 -08:00
Peter Klausler 968eabbd9d [flang] Merge pull request flang-compiler/f18#871 from flang-compiler/pmk-fixes
Fix remaining failures in expression semantics

Original-commit: flang-compiler/f18@7473f0bcd7
Reviewed-on: https://github.com/flang-compiler/f18/pull/871
2019-12-16 12:54:55 -08:00
peter klausler d08b010408 [flang] Apply implicit typing to names in COMMON that appear in specification expressions
Extend semantic analysis of expressions to catch missing cases

Fix statement function semantics, add degree trig intrinsics

Add GetUltimate to rewrite of bare namelist

Address review comments

Original-commit: flang-compiler/f18@52ff319de2
Reviewed-on: https://github.com/flang-compiler/f18/pull/871
2019-12-16 12:34:44 -08:00
Eric Schweitz f061d34509 [flang] Merge pull request flang-compiler/f18#869 from schweitzpgi/master
remove stale optimizer files

Original-commit: flang-compiler/f18@6a8dec4991
Reviewed-on: https://github.com/flang-compiler/f18/pull/869
2019-12-16 08:39:17 -08:00
Eric Schweitz f90350021a [flang] remove stale optimizer files
Original-commit: flang-compiler/f18@c497c135f6
Reviewed-on: https://github.com/flang-compiler/f18/pull/869
2019-12-13 14:46:20 -08:00
Eric Schweitz 5c5880db2f [flang] Merge pull request flang-compiler/f18#868 from schweitzpgi/remove-flatten
remove some old files

Original-commit: flang-compiler/f18@3d05d39e36
Reviewed-on: https://github.com/flang-compiler/f18/pull/868
2019-12-11 16:47:06 -08:00
Eric Schweitz abf50fc3a7 [flang] remove some old files
Original-commit: flang-compiler/f18@d7554c7605
Reviewed-on: https://github.com/flang-compiler/f18/pull/868
2019-12-11 13:33:02 -08:00
Gary Klimowicz 3e65606837 [flang] Flang relicense: LICENSE file and one change (flang-compiler/f18#867)
Add new license text to runtime/magic-numbers.h, which is unusual
in that it is the only .h file in flang that is intended to be
included in either C or Fortran files. This requires special
handling of the license text.

Original-commit: flang-compiler/f18@61bb9db531
Reviewed-on: https://github.com/flang-compiler/f18/pull/867
2019-12-11 11:13:48 -08:00
Kiran Kumar T P b96a26c1fc [flang] Updated call10.f90 with more test for flang-compiler/f18#794-Check for PURE procedures containing image control statements (flang-compiler/f18#857)
Original-commit: flang-compiler/f18@ae4868e572
Reviewed-on: https://github.com/flang-compiler/f18/pull/857
2019-12-11 09:11:59 -08:00
jeanPerier a66086749b [flang] Merge pull request flang-compiler/f18#865 from flang-compiler/jpr-fix-cplx-power
Fix INTGER**COMPLEX regression introduced by PR 858

Original-commit: flang-compiler/f18@53545d7436
Reviewed-on: https://github.com/flang-compiler/f18/pull/865
2019-12-10 23:52:48 -08:00
Jean Perier cdf4ef4962 [flang] Fix INTGER**COMPLEX regression introduced by PR 858
Fix bad copy past that had introduced an unitialized value use.

Original-commit: flang-compiler/f18@9a84bcb9ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/865
2019-12-10 01:21:50 -08:00
arjunsuresh1987 562b067439 [flang] Fix file path in cmake (flang-compiler/f18#844)
Original-commit: flang-compiler/f18@4771f8cb78
Reviewed-on: https://github.com/flang-compiler/f18/pull/844
2019-12-10 14:07:56 -08:00
Peter Klausler 84c0faa5b6 [flang] Merge pull request flang-compiler/f18#864 from flang-compiler/pmk-fix
Revert recent addition of ActualArgument::PassedObject

Original-commit: flang-compiler/f18@d1b6e3cd2c
Reviewed-on: https://github.com/flang-compiler/f18/pull/864
2019-12-10 12:39:52 -08:00
peter klausler e693198c5c [flang] Revert recent addition of ActualArgument::PassedObject
reformatting

Complete merging with current master

implement extension of inherited type-bound generics

Original-commit: flang-compiler/f18@e58c4e53c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/864
2019-12-10 11:56:40 -08:00
Tim Keith a27ed74672 [flang] Merge pull request flang-compiler/f18#863 from flang-compiler/tsk-defined-op2
Resolve calls to type-bound generic names

Original-commit: flang-compiler/f18@b3bb698086
Reviewed-on: https://github.com/flang-compiler/f18/pull/863
2019-12-09 14:26:59 -08:00