Commit graph

2432 commits

Author SHA1 Message Date
Tim Keith
396a659413 [flang] Resolve index in pointer assignment to array element
When the LHS of a pointer assignment is an array element, the
index must be resolved.

Fixed flang-compiler/f18#684.

Original-commit: flang-compiler/f18@c39c7872d4
Reviewed-on: https://github.com/flang-compiler/f18/pull/687
2019-08-26 17:37:52 -07:00
Steve Scalpone
9de2bf6aa8 [flang] Merge pull request flang-compiler/f18#693 from kiranchandramohan/segfault_invalid_interface
Fix for segfault in invalid proc interface message

Original-commit: flang-compiler/f18@705c3532ef
Reviewed-on: https://github.com/flang-compiler/f18/pull/693
2019-08-27 16:21:06 -07:00
Kiran Chandramohan
911cb63719 [flang] Fix for segfault in invalid proc interface message
The segfault happened due to a missing argument.

Original-commit: flang-compiler/f18@8a4f49e86d
Reviewed-on: https://github.com/flang-compiler/f18/pull/693
2019-08-27 23:28:15 +01:00
Peter Klausler
20473b6939 [flang] Merge pull request flang-compiler/f18#690 from flang-compiler/pmk-sjs-omp-lib
Clean up `omp_lib.h` a bit

Original-commit: flang-compiler/f18@e5830301bd
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
2019-08-27 13:16:25 -07:00
peter klausler
142fed87c1 [flang] Clean up omp_lib.h
Original-commit: flang-compiler/f18@7119cd0534
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
2019-08-27 11:17:43 -07:00
peter klausler
9d5d73aa77 [flang] Reformat omp_lib.h
Original-commit: flang-compiler/f18@892d91b161
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
2019-08-27 09:28:30 -07:00
Steve Scalpone
5c62bfb4f8 [flang] Implement int_ptr_kind.
Split omp_lib.F90 into two files: a Fortran file used to
create the omp_lib module and a .h file that can be used
directly, which apparently some codes do. Because of the
split, and wanting to avoid forcing use isc_c_binding,
use int_ptr_kind()  instead of c_intptr_t.

Original-commit: flang-compiler/f18@ce6a9fb173
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
2019-08-26 14:58:10 -07:00
Steve Scalpone
9b5e691814 [flang] Add the OpenMP module.
Original-commit: flang-compiler/f18@09d8b0d6e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/690
Tree-same-pre-rewrite: false
2019-08-26 09:57:06 -07:00
Steve Scalpone
aa907c3125 [flang] Merge pull request flang-compiler/f18#681 from DavidTruby/master
Fix for builds with libc++9 and libstdc++10

Original-commit: flang-compiler/f18@fae1187462
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
2019-08-27 12:00:28 -07:00
David Truby
1281b9c5fc [flang] Misc changes for review
Original-commit: flang-compiler/f18@6d9ddb8f5e
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
2019-08-23 21:17:57 +01:00
David Truby
0adca8bedc [flang] Fix for builds with libc++9 and libstdc++10
Original-commit: flang-compiler/f18@137de8a1cd
Reviewed-on: https://github.com/flang-compiler/f18/pull/681
Tree-same-pre-rewrite: false
2019-08-23 14:57:05 +01:00
Tim Keith
51fe223916 [flang] Fix bug with statement functions
When the name of a statement function was previously declared, we
weren't correctly recognizing it as a statement function. E.g.
```
integer :: f, i
f(i) = i + 1
```

`f` was entered in the symbol table with `EntityDetails` and the
`parser::Name` on the first line was resolved to that symbol.
On the second line we replaced the symbol for `f` in the scope
with a subprogram symbol, but that didn't change the symbol in
the first `parser::Name`.

The fix requires:
1. don't erase the original symbol for `f`, just replace its details
2. when we erase the symbol for `f` in the subprogram scope, don't
   unresolve it

Original-commit: flang-compiler/f18@31212686ea
2019-08-26 15:46:49 -07:00
jeanPerier
986fec95a1 [flang] Merge pull request flang-compiler/f18#680 from flang-compiler/jpr-fix-661
Fix issue: Enforce specific intrinsic characteristics

Original-commit: flang-compiler/f18@0758d8a65e
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
2019-08-26 01:45:48 -07:00
Jean Perier
98af2162d0 [flang] Fix intrinsic table probing issue with DOUBLE COMPLEX
The probing table was only expecting REAL for kind code
`KindCode::doublePrecision` that is also used for
`DoublePrecisionComplex`.
Add related tests.

Original-commit: flang-compiler/f18@342ed7e769
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
2019-08-23 05:37:37 -07:00
Jean Perier
252e22ea97 [flang] Fix issue: Enforce specific intrinsic characteristics
Fix issue flang-compiler/f18#661.
The issue was that when probing a specific intrinsic, the
constraints of the related generic intrinsic were tested instead
of the more restrictive constraints of the specific intrinsic.

Original-commit: flang-compiler/f18@dd971e901d
Reviewed-on: https://github.com/flang-compiler/f18/pull/680
Tree-same-pre-rewrite: false
2019-08-23 05:03:41 -07:00
jeanPerier
4a624715aa [flang] Merge pull request flang-compiler/f18#679 from flang-compiler/jpr-fix-676
Fix SELECTED_CHAR_KIND('DEFAULT') folding issue

Original-commit: flang-compiler/f18@6703f7bd99
Reviewed-on: https://github.com/flang-compiler/f18/pull/679
2019-08-26 01:11:34 -07:00
Jean Perier
8c4d2e8763 [flang] Fix SELECTED_CHAR_KIND('DEFAULT') folding issue
Fix issue flang-compiler/f18#676
The issue was that the 'DEFAULT' case was handled
directly in fold.cc which did not lowercase/trim trailing
space of the argument befaore comparing to "default".

Modify the `Selected_char_kind` function to accept the default
char kind as argument and to return it if the processed argument
matches "default".

Original-commit: flang-compiler/f18@14222ae914
Reviewed-on: https://github.com/flang-compiler/f18/pull/679
2019-08-23 03:36:29 -07:00
Peter Klausler
61814dbf1d [flang] Merge pull request flang-compiler/f18#671 from flang-compiler/pmk-decimal
Better binary<->decimal floating-point conversion

Original-commit: flang-compiler/f18@5e93f2c602
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
2019-08-23 11:51:54 -07:00
peter klausler
9717cc43b8 [flang] Make it easier to enable minimal FP output by default for module files (but do not enable it)
Original-commit: flang-compiler/f18@f6b640319b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
2019-08-23 11:31:47 -07:00
peter klausler
b7d463f1d5 [flang] Cope better with ridiculously large exponents on input
Original-commit: flang-compiler/f18@e55cc39bad
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:47 -07:00
peter klausler
787b997830 [flang] Address most review comments
Original-commit: flang-compiler/f18@e6164782ea
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:46 -07:00
peter klausler
79e8749f25 [flang] Address comments, fix a bug
Original-commit: flang-compiler/f18@e095bbb23f
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:45 -07:00
peter klausler
b4f34801c6 [flang] Improve comments, clean up a couple of things
Original-commit: flang-compiler/f18@8d94d643b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:43 -07:00
peter klausler
1502542fe7 [flang] Fix copyright date on new file.
Original-commit: flang-compiler/f18@60b1be7ce2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:43 -07:00
peter klausler
474c43a075 [flang] Correct header guards
Original-commit: flang-compiler/f18@77688d0392
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:40 -07:00
peter klausler
bd3debe841 [flang] Reenable thorough test
Original-commit: flang-compiler/f18@431254483e
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:38 -07:00
peter klausler
28d55be08b [flang] Better unsigned division by constants
Original-commit: flang-compiler/f18@1b35c24a8a
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:37 -07:00
peter klausler
b5408d26ed [flang] Clean up some static_casts
Original-commit: flang-compiler/f18@a5f81388a2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:34 -07:00
peter klausler
3f15d46f63 [flang] Simplify guard bits (only use 3)
Original-commit: flang-compiler/f18@b710268c1b
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:33 -07:00
peter klausler
64a0a58bed [flang] Work around slow clang-7
Original-commit: flang-compiler/f18@ed634d72e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:32 -07:00
peter klausler
b235c63caf [flang] faster Parse
Original-commit: flang-compiler/f18@ca97439c68
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:31 -07:00
peter klausler
c4696eaf8e [flang] Get clean build with gcc
Original-commit: flang-compiler/f18@e6b5ed152d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:30 -07:00
peter klausler
94d8b3f25b [flang] Simplify decimal->binary
Original-commit: flang-compiler/f18@01aefbbd7a
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:29 -07:00
peter klausler
d08c9c9d1d [flang] Make thorough test thorough again
Original-commit: flang-compiler/f18@c24b10e434
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:27 -07:00
peter klausler
95165a3921 [flang] Replace usage of original decimal conversion code with calls to new library
Original-commit: flang-compiler/f18@7a164451f2
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:26 -07:00
peter klausler
099838a34d [flang] Debug test
Original-commit: flang-compiler/f18@bf2c22bcf4
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:25 -07:00
peter klausler
77b3c6d53a [flang] More testing, added thorough 32-bit sweep test
Original-commit: flang-compiler/f18@f81b92f91c
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:25 -07:00
peter klausler
3863551b31 [flang] Testing & debugging
Original-commit: flang-compiler/f18@f7f933e7f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:24 -07:00
peter klausler
afda616c31 [flang] Begin adding tests
Original-commit: flang-compiler/f18@8776d8b663
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:20 -07:00
peter klausler
9cdb101a4d [flang] clean up a todo
Original-commit: flang-compiler/f18@1107bd1f02
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:18 -07:00
peter klausler
93f3ae8aeb [flang] Enforce digit limits
Original-commit: flang-compiler/f18@33600e127d
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:16 -07:00
peter klausler
b53e09c44c [flang] Add rounding modes
Original-commit: flang-compiler/f18@9caa1a29a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:13 -07:00
peter klausler
9e26defed3 [flang] Code snapshot
Original-commit: flang-compiler/f18@46923344ca
Reviewed-on: https://github.com/flang-compiler/f18/pull/671
Tree-same-pre-rewrite: false
2019-08-23 11:31:12 -07:00
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
Tim Keith
d1dcd76d14 [flang] Merge pull request flang-compiler/f18#675 from flang-compiler/tsk-modfiles2
Fix bugs in .mod file generation

Original-commit: flang-compiler/f18@5de0847a64
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
2019-08-23 11:28:33 -07:00
Tim Keith
a03a0432f3 [flang] Add conversions from EnumSet<Attr> to Attrs
This allows operations from EnumSet (e.g. `operator&`) to work as expected.

Original-commit: flang-compiler/f18@c8b8b742c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
2019-08-23 08:28:20 -07:00
Tim Keith
5e65aaa921 [flang] Fix .mod file bug with IMPORT of USEd name
If a symbol (derived type, for example) was use-associated into a scope
and then imported into a nested interface block, we were not including
the correct IMPORT statement in the .mod file.

This fixes refines the test for when the IMPORT is needed.

Fixes flang-compiler/f18#657.

Original-commit: flang-compiler/f18@8383de47ec
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Tim Keith
191a5e34b0 [flang] Fix bug in .mod file for some subprogram attributes
Some attributes for subprograms can be in the subprogram prefix but
others cannot. For the latter, emit a separate attribute statement
to specify them. We were already doing that for PRIVATE but not for
OPTIONAL. Those may be the only two attributes this can apply to.

Fixes flang-compiler/f18#659.

Original-commit: flang-compiler/f18@ae67e08780
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Tim Keith
abd56ee7fd [flang] Fix writing defined operators to .mod files
When defined operators were written to .mod files in USE statement
they did not come out correctly. They have to be emitted with
`PutGenericName()` so that `operator` is included.

Original-commit: flang-compiler/f18@d40e65a2f9
Reviewed-on: https://github.com/flang-compiler/f18/pull/675
Tree-same-pre-rewrite: false
2019-08-23 07:14:55 -07:00
Jinxin (Brian) Yang
20eaba0392 [flang] [OpenMP] miscellaneous parse tree updates (flang-compiler/f18#673)
1. Big chunk: update comments in parse-tree.h and openmp-grammar.h
   with Spec chapter/section info, simple explanation, or productions.

2. Update `To`, `Link`, and `From` clauses with `OmpObjectList` to allow
   `/Common Block/`. Spec does not mention whether `Common Block name`
   should be accepted or not, so we should assume that these clauses
   accept normal `list-item`, which is `Variable`, `Array Section`, or
   `Common Block name`.

Original-commit: flang-compiler/f18@140315cb62
Reviewed-on: https://github.com/flang-compiler/f18/pull/673
2019-08-23 09:45:03 -07:00