Commit Graph

2472 Commits

Author SHA1 Message Date
Tim Keith b506f39f18 [flang] Clean up temp dirs
A temp directory is created in `common.sh` and it is cleaned up by
`trap ... EXIT`. If the test script has its own trap, as this one does,
it seems to replace the first one. So the cleanup from `common.sh` was
not being executed when the `%t` feature was used and empty temp
directories were being left in the directory where the tests ran.

Since we already have a temp directory that is cleaned up, just use
that for `%t` and don't bother with another `mktemp`.

Original-commit: flang-compiler/f18@f61d62ddec
Reviewed-on: https://github.com/flang-compiler/f18/pull/754
2019-09-18 13:17:48 -07:00
Jinxin Yang bb1127efb6 [flang] [OpenMP] Simplify `OmpObject` with `std::variant`
Instead of using an `ENUM_CLASS Kind` to distinguish a `Designator`
or common-block name, change it to `std::variant`. If the `Name`
is available, then it is common-block name.

Original-commit: flang-compiler/f18@abf5db6171
2019-09-18 15:46:20 -07:00
jeanPerier ac761ca21a [flang] Merge pull request flang-compiler/f18#743 from flang-compiler/jpr-fix-726
Prevent RESULT name from being the same as the function name

Original-commit: flang-compiler/f18@648d6b9eea
Reviewed-on: https://github.com/flang-compiler/f18/pull/743
2019-09-17 01:33:43 -07:00
Jean Perier ba89315523 [flang] Address comment: make error a warning instead and ignore RESULT
Instead of emitting an error when RESULT has the same name as the
function, emit a warning and ignore RESULT in the rest of the
compilation.

Original-commit: flang-compiler/f18@8ce3862d39
Reviewed-on: https://github.com/flang-compiler/f18/pull/743
2019-09-16 03:36:12 -07:00
Jean Perier ca86308453 [flang] Prevent RESULT name from being the same as the function.
Fix flang-compiler/f18#726.
Add test and error messsage for such scenario and set error on the
result symbol because it is unclear what it is inside the function.

Original-commit: flang-compiler/f18@a3d5b5af0d
Reviewed-on: https://github.com/flang-compiler/f18/pull/743
Tree-same-pre-rewrite: false
2019-09-13 09:44:05 -07:00
Tim Keith fe22112322 [flang] Merge pull request flang-compiler/f18#740 from flang-compiler/tsk5
Fix bugs with use-association renames

Original-commit: flang-compiler/f18@61d5c7a8c1
Reviewed-on: https://github.com/flang-compiler/f18/pull/740
2019-09-16 07:54:27 -07:00
Tim Keith a29678ddb6 [flang] Fix bugs with use-associated derived type with rename
When a derived type is use-associated with a rename, like
`use m, only: t2 => t1`
we need to record in the `DerivedTypeSpec` both the local-name in this
scope and the symbol for the derived type.

In most cases we need to work the the type symbol and its
`DerivedTypeDetails`, but when writing the type to the module file
we need the local-name. The name of the type symbol may be hidden
or not use-associated.

When analyzing a `parser::Name` we don't want to follow use-associations
because we could end up with the wrong name in a `DataRef` (i.e. the
use-name rather than the local-name). But that means that
`GetNamedConstantValue()` does have to follow them or named constants
won't always be folded.

Fixes flang-compiler/f18#729.

Original-commit: flang-compiler/f18@50d8921c69
Reviewed-on: https://github.com/flang-compiler/f18/pull/740
2019-09-16 07:54:27 -07:00
Tim Keith 0b86ab186d [flang] Fix renames in module files
When a module contains a use-association with rename, we have to be
careful to use the correct name (i.e. the local-name, not the use-name)
when writing out its `.mod` file.

When analyzing a `Name` in an expression, follow the use-association
for details, attributes, and constant values; but if we need to make a
`Designator` or `ProcedureDesignator`, use the local name.

Original-commit: flang-compiler/f18@8f07b803e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/740
Tree-same-pre-rewrite: false
2019-09-16 07:54:27 -07:00
Tim Keith ce8b500d57 [flang] Refactoring
Eliminate two of the three overloadings of `Scope::MakeDerivedType()`.
Keep the one that has `Category` first because that's the order the
constructor of `DeclTypeSpec` uses.

In `mod-file.cc`, eliminate some calls to `PutLower()`. Symbols and
names are already lower case so they don't need to be converted.

In `modfile03.f90`, move the expected `.mod` file comments to right
after the corresponding modules. That makes it easier to work with.

Original-commit: flang-compiler/f18@86874d9bf8
Reviewed-on: https://github.com/flang-compiler/f18/pull/740
Tree-same-pre-rewrite: false
2019-09-16 07:54:27 -07:00
Tim Keith a10899f729 [flang] Merge pull request flang-compiler/f18#741 from flang-compiler/tsk-issue733
Fix bug merging generics on USE

Original-commit: flang-compiler/f18@5cedc81d15
Reviewed-on: https://github.com/flang-compiler/f18/pull/741
2019-09-16 07:30:54 -07:00
Tim Keith 4fde74a1c8 [flang] Address review comment
Original-commit: flang-compiler/f18@134190f75e
Reviewed-on: https://github.com/flang-compiler/f18/pull/741
2019-09-13 14:39:40 -07:00
Tim Keith f13cf9f0ed [flang] Better handling of merged generics
If a generic name is use-associated from two different modules and they
both have a specific procedure or both have a derived type with the same
name, report it as an error.

Original-commit: flang-compiler/f18@42369af96d
Reviewed-on: https://github.com/flang-compiler/f18/pull/741
Tree-same-pre-rewrite: false
2019-09-13 14:27:33 -07:00
Tim Keith d43405e4e6 [flang] Fix bug merging generics on USE
When we use-associate the same generic name from two different modules
they are merged together. If the same specific procedure occurs in both
generics it should only occur once in the merged one.

Similarly, it's not an error if they both have a derived type or
specific procedure named the same as the generic, as long as they are
the same symbol.

Fixes flang-compiler/f18#733.

Original-commit: flang-compiler/f18@d37db07691
Reviewed-on: https://github.com/flang-compiler/f18/pull/741
Tree-same-pre-rewrite: false
2019-09-12 17:38:40 -07:00
Steve Scalpone 6f9ae14b27 [flang] Merge pull request flang-compiler/f18#719 from DavidTruby/target
Semantic checks for target construct

Original-commit: flang-compiler/f18@2752d09c3a
Reviewed-on: https://github.com/flang-compiler/f18/pull/719
2019-09-14 09:14:51 -07:00
David Truby da26e76078 [flang] Changed missing tofrom:scalar error message to be more descriptive
Original-commit: flang-compiler/f18@18e0a55a02
Reviewed-on: https://github.com/flang-compiler/f18/pull/719
2019-09-11 11:23:36 +01:00
David Truby 9527a18816 [flang] Added tofrom:scalar check for defaultmap clause
Original-commit: flang-compiler/f18@1025649b64
Reviewed-on: https://github.com/flang-compiler/f18/pull/719
Tree-same-pre-rewrite: false
2019-09-10 14:04:03 +01:00
David Truby 4b30ecf11c [flang] Semantic checks for target construct
Original-commit: flang-compiler/f18@373391bc03
Reviewed-on: https://github.com/flang-compiler/f18/pull/719
Tree-same-pre-rewrite: false
2019-09-10 13:49:24 +01:00
Peter Klausler f9f0ff1978 [flang] Merge pull request flang-compiler/f18#745 from flang-compiler/pmk-call
Implement checks for test/semantics/call02.f90

Original-commit: flang-compiler/f18@45604a2d72
Reviewed-on: https://github.com/flang-compiler/f18/pull/745
2019-09-13 14:00:18 -07:00
peter klausler 1c10d963aa [flang] Remove periods from the ends of messages, per review comment
Original-commit: flang-compiler/f18@0ce32de0d6
Reviewed-on: https://github.com/flang-compiler/f18/pull/745
2019-09-13 13:57:35 -07:00
peter klausler 9c3a9375be [flang] Implement checks for test/semantics/call02.f90
Original-commit: flang-compiler/f18@38eaaa72ff
Reviewed-on: https://github.com/flang-compiler/f18/pull/745
Tree-same-pre-rewrite: false
2019-09-13 12:32:43 -07:00
Jinxin Yang 5676797c2a [flang] Improve flag dumping for -funparse-with-symbols
Original-commit: flang-compiler/f18@768fb1b369
2019-09-13 12:39:27 -07:00
Peter Klausler a443fdcb6a [flang] Merge pull request flang-compiler/f18#736 from flang-compiler/pmk-fix-expo
Do not emit a bogus exponent on zero (0.e-1)

Original-commit: flang-compiler/f18@ab19f2e9a7
Reviewed-on: https://github.com/flang-compiler/f18/pull/736
2019-09-12 10:41:09 -07:00
peter klausler f2917c777b [flang] Do not emit a bogus exponent (0.e-1)
Original-commit: flang-compiler/f18@3d0b13d7ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/736
2019-09-12 10:28:16 -07:00
Peter Klausler 722ffc3e2d [flang] Merge pull request flang-compiler/f18#738 from flang-compiler/pmk-fix-735
Fix bug flang-compiler/f18#735

Original-commit: flang-compiler/f18@675ccd4208
Reviewed-on: https://github.com/flang-compiler/f18/pull/738
2019-09-12 10:27:46 -07:00
peter klausler 8fc7824feb [flang] tweak test results
Original-commit: flang-compiler/f18@360c6717e7
Reviewed-on: https://github.com/flang-compiler/f18/pull/738
2019-09-12 09:40:29 -07:00
peter klausler 988749e8f3 [flang] Fix bug flang-compiler/f18#735
Original-commit: flang-compiler/f18@dccb16d492
Reviewed-on: https://github.com/flang-compiler/f18/pull/738
Tree-same-pre-rewrite: false
2019-09-12 09:40:28 -07:00
peter klausler c93ceeeef7 [flang] Improve error message (add types)
Original-commit: flang-compiler/f18@48b8f32d51
Reviewed-on: https://github.com/flang-compiler/f18/pull/738
Tree-same-pre-rewrite: false
2019-09-12 09:40:27 -07:00
jeanPerier ea7652a251 [flang] Merge pull request flang-compiler/f18#734 from flang-compiler/jpr-fix-700
Add NEW_LINE intrinsic to the intrinsic table

Original-commit: flang-compiler/f18@9c10e02d39
Reviewed-on: https://github.com/flang-compiler/f18/pull/734
2019-09-12 00:31:29 -07:00
Jean Perier 48659b1eb0 [flang] Add NEW_LINE intrinsic to the intrinsic table
NEW_LINE intrinsic folding was already implemented but it had not
yet been added the the intrinsic table and was therefore not yet
recognised an intrinsic.
Add related tests.

Original-commit: flang-compiler/f18@42fcf5b5f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/734
2019-09-11 03:01:55 -07:00
Peter Klausler 05f75ac01f [flang] Merge pull request flang-compiler/f18#737 from flang-compiler/pmk-m-in-m
Allow module, submodule, and program names to be used as local identi…

Original-commit: flang-compiler/f18@ffc90d0b1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/737
2019-09-11 16:40:09 -07:00
peter klausler bd2bf58e7a [flang] Extend comments
Original-commit: flang-compiler/f18@9f918c2559
Reviewed-on: https://github.com/flang-compiler/f18/pull/737
2019-09-11 13:15:32 -07:00
peter klausler 62e4acf232 [flang] Allow module, submodule, and program names to be used as local identifiers. Check for USE of m in m.
Original-commit: flang-compiler/f18@9abfd9e450
Reviewed-on: https://github.com/flang-compiler/f18/pull/737
Tree-same-pre-rewrite: false
2019-09-11 12:30:24 -07:00
Tim Keith 2deefe166c [flang] Merge pull request flang-compiler/f18#698 from tinlun/master
Added -fget-definition and -fget-symbols-sources.

Original-commit: flang-compiler/f18@24caaea2bf
Reviewed-on: https://github.com/flang-compiler/f18/pull/698
2019-09-11 11:10:57 -07:00
Tin Huynh 2e1807998c [flang] Using new Prov to Cooked mappings for get-definition.
Original-commit: flang-compiler/f18@5a42c5c9e1
Reviewed-on: https://github.com/flang-compiler/f18/pull/698
2019-09-10 17:55:59 -07:00
Tin Huynh 69fd49a002 [flang] FindOffsetLineAndColumn also uses SourcePosition.
New tests for COMMON and BLOCK.
Added CHECK-ONCE to test_any.sh. Make sure pattern only occurs once.

Original-commit: flang-compiler/f18@ad82dafcf9
Reviewed-on: https://github.com/flang-compiler/f18/pull/698
Tree-same-pre-rewrite: false
2019-09-10 17:55:59 -07:00
Tin Huynh 2f205a5f52 [flang] Added -fget-definitions and -fget-all-symbols.
- -fget-definitions finds the definition of the symbol under specified source
position.
- -fget-all-symbols finds definition locations of all symbols in a document. For
symbols found in other modules, shows which module the symbol came from.
- Tests.
- New structure SourcePosition with file, line, column information.

Original-commit: flang-compiler/f18@e0099b0900
Reviewed-on: https://github.com/flang-compiler/f18/pull/698
Tree-same-pre-rewrite: false
2019-09-10 17:55:59 -07:00
Peter Klausler 99fb2cfc2f [flang] Merge pull request flang-compiler/f18#731 from flang-compiler/pmk-fix-728
Recover better from syntax errors on USE statements

Original-commit: flang-compiler/f18@2c45d65b88
Reviewed-on: https://github.com/flang-compiler/f18/pull/731
2019-09-11 09:16:29 -07:00
peter klausler f9ed573b1d [flang] Recover better from syntax errors on USE statements
Original-commit: flang-compiler/f18@29968698d9
Reviewed-on: https://github.com/flang-compiler/f18/pull/731
2019-09-10 15:29:55 -07:00
Peter Klausler 98a7408347 [flang] Merge pull request flang-compiler/f18#732 from flang-compiler/pmk-call
Begin semantic checks for calls

Original-commit: flang-compiler/f18@4d6ae6fab0
Reviewed-on: https://github.com/flang-compiler/f18/pull/732
2019-09-10 17:09:07 -07:00
peter klausler 67eb35d970 [flang] Address review comment
Original-commit: flang-compiler/f18@65dc8d4996
Reviewed-on: https://github.com/flang-compiler/f18/pull/732
2019-09-10 17:08:18 -07:00
peter klausler 9db810f5e3 [flang] Add static declaration checker; get call01.f90 to pass
Original-commit: flang-compiler/f18@7cc5bc7617
Reviewed-on: https://github.com/flang-compiler/f18/pull/732
Tree-same-pre-rewrite: false
2019-09-10 15:53:23 -07:00
peter klausler 2ae26b8501 [flang] Check recursive calls for NON_RECURSIVE and assumed-length CHARACTER(*)
Original-commit: flang-compiler/f18@92777f8f66
Reviewed-on: https://github.com/flang-compiler/f18/pull/732
Tree-same-pre-rewrite: false
2019-09-10 15:53:22 -07:00
peter klausler 34f07e50c0 [flang] commit to switch branches
Some groundwork

Original-commit: flang-compiler/f18@64ebeb511c
Reviewed-on: https://github.com/flang-compiler/f18/pull/732
Tree-same-pre-rewrite: false
2019-09-10 15:53:17 -07:00
psteinfeld df632a4cbc [flang] Merge pull request flang-compiler/f18#686 from flang-compiler/ps-stmt-stack
Changes to add an executable construct stack

Original-commit: flang-compiler/f18@2fc28c7538
Reviewed-on: https://github.com/flang-compiler/f18/pull/686
2019-09-10 15:25:00 -07:00
Pete Steinfeld 97d7b398e4 [flang] Combined the implementations to ```Pre()``` and ```Post()``` functions that
call `PushConstruct()``` and ```PopConstruct()``` following a genius
suggestion from Peter.

Original-commit: flang-compiler/f18@be2a03ebf4
Reviewed-on: https://github.com/flang-compiler/f18/pull/686
2019-09-10 14:45:02 -07:00
Pete Steinfeld 74112759c3 [flang] Changed ```PushConstruct()``` to be a template, which moves the implicit
creation of the ```ConstructNode``` into ```PushConstruct()```.

Original-commit: flang-compiler/f18@3984566858
Reviewed-on: https://github.com/flang-compiler/f18/pull/686
Tree-same-pre-rewrite: false
2019-09-10 14:45:02 -07:00
Pete Steinfeld 9cc2f8300b [flang] Responses to review comments
I changed the interface of ```PushConstruct()``` to take an rvalue reference as its only parameter and made the construction of the ```ConstructNode```s explicit in all of the ```Pre()``` functions for the various construct types.

Original-commit: flang-compiler/f18@f8be813874
Reviewed-on: https://github.com/flang-compiler/f18/pull/686
Tree-same-pre-rewrite: false
2019-09-10 14:45:02 -07:00
Pete Steinfeld eedbe90e72 [flang] Responses to review comments and team meeting
The most significant change is that I replaced the stack of
ExecutableConstruct's with a stack composed of ConstructNode's, each of which
is a variant of the constructs that made up the type ExecutableConstruct.  This
change allows the nodes of the stack to be extended to include the types needed
for OMP semantic checking.

I also extended the existing test to include some correct DO loops with CYCLE
and EXIT statements to test the code more completely.

Original-commit: flang-compiler/f18@d26f34e3a4
Reviewed-on: https://github.com/flang-compiler/f18/pull/686
Tree-same-pre-rewrite: false
2019-09-10 14:45:02 -07:00
Pete Steinfeld 73ef31b164 [flang] Changes to add an executable construct stack
I added a stack of ExecutableConstruct's to SemanticsContext along with
functions to push and pop constructs.  I added code to the SemanticsVisitor
to use these new functions.  I also added functions Pre and Post functions
for UnlabeledStatement's so that we could isolate the source positions for
statements embedded in "if" statements to improve error messages.

I also added code to check-do.[h,cc] to use this new infrastructure to check
for CYCLE and EXIT statements that are not contained within DO constructs
along with a test.

Original-commit: flang-compiler/f18@b8370bdeb8
Reviewed-on: https://github.com/flang-compiler/f18/pull/686
Tree-same-pre-rewrite: false
2019-09-10 14:45:02 -07:00
psteinfeld ada293fa66 [flang] Merge pull request flang-compiler/f18#730 from flang-compiler/ps-issue725
Fixed the declarations of IEEE_SUPPORT_FLAG and IEEE_SUPPORT_HALTING

Original-commit: flang-compiler/f18@238b9ee459
Reviewed-on: https://github.com/flang-compiler/f18/pull/730
2019-09-10 12:50:17 -07:00