Commit Graph

2696 Commits

Author SHA1 Message Date
peter klausler 686baf0b0e [flang] Remove dead code
Original-commit: flang-compiler/f18@4d90aad361
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:33 -07:00
peter klausler 32f2ea0753 [flang] Build with all compilers * versions
Original-commit: flang-compiler/f18@7332caa613
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:31 -07:00
peter klausler fc5d127c1c [flang] Complete conversions, delete old visitor
Original-commit: flang-compiler/f18@6ce1da55c8
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:30 -07:00
peter klausler f07d6bc6ba [flang] more conversions to Traverse
Original-commit: flang-compiler/f18@e8668e2368
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:29 -07:00
peter klausler 48fd773a19 [flang] Refinements; replace several clients of old Visitor with new Traverse
Original-commit: flang-compiler/f18@0b44a86e31
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:28 -07:00
peter klausler e6e66c022b [flang] Redo IsInitialDataTarget
Original-commit: flang-compiler/f18@988c38e1f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:27 -07:00
peter klausler 0bc6d134a6 [flang] Repackaging; tests pass
Original-commit: flang-compiler/f18@1fa7bb7717
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:26 -07:00
peter klausler c36f7d916a [flang] progress
Original-commit: flang-compiler/f18@b5e3e709cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:24 -07:00
peter klausler 8d8e1c4604 [flang] add test
Original-commit: flang-compiler/f18@ad2fa9dfdf
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:23 -07:00
peter klausler 9016b1d6a8 [flang] checkpoint
Original-commit: flang-compiler/f18@96ade8e6e9
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:22 -07:00
peter klausler e9dda4f0f5 [flang] checkpoint
Original-commit: flang-compiler/f18@782f44fe7d
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:20 -07:00
psteinfeld acda903be8 [flang] Merge pull request flang-compiler/f18#756 from flang-compiler/ps-do
Implementation of semantic checks C1135, C1167, and C1168

Original-commit: flang-compiler/f18@e43377f999
Reviewed-on: https://github.com/flang-compiler/f18/pull/756
2019-09-25 08:49:46 -07:00
Pete Steinfeld ea1cf9ee0b [flang] More responses to pull request comments.
Original-commit: flang-compiler/f18@0fb4cf1c9b
Reviewed-on: https://github.com/flang-compiler/f18/pull/756
2019-09-24 15:33:51 -07:00
Pete Steinfeld 33b208e487 [flang] More responses to comments in the pull request. The big change was to
implement an enum class to indicate whether the statement being checked
is a CYCLE or EXIT statement.  This change rippled through a few
interfaces, resulting in cleaner, more readable code.  Thanks for the
tip, Tim!

Original-commit: flang-compiler/f18@e167c3d39f
Reviewed-on: https://github.com/flang-compiler/f18/pull/756
Tree-same-pre-rewrite: false
2019-09-24 10:44:44 -07:00
Pete Steinfeld e0eee884b2 [flang] Responses to a comments in my previous pull request.
Original-commit: flang-compiler/f18@e0d73a45ac
Reviewed-on: https://github.com/flang-compiler/f18/pull/756
Tree-same-pre-rewrite: false
2019-09-23 20:49:55 -07:00
Pete Steinfeld ab12314514 [flang] Implementation of semantic checks C1135, C1167, and C1168
These constraints state that CYCLE and EXIT statements should not leave DO
CONCURRENT, CRITICAL, or CHANGE TEAM constructs.

I added checking code to check-do.cc and removed some superseded code from
check-do.cc and semantics.cc.  The new code uses the construct stack
implemented in my previous pull request.

I also added a new test -- dosemantics11.f90 and modified the tests
dosemantics10.f90, doconcurrent05.f90, and doconcurrent06.f90 to adapt to
the new error messages.  I converted these latter two tests to use
test_error.sh since they only reported errors.

Original-commit: flang-compiler/f18@b0bea7da64
Reviewed-on: https://github.com/flang-compiler/f18/pull/756
Tree-same-pre-rewrite: false
2019-09-23 20:49:55 -07:00
jeanPerier 505b214493 [flang] Merge pull request flang-compiler/f18#749 from flang-compiler/jpr-fix-724-2
Allow more argument types in some specific intrinsic

Original-commit: flang-compiler/f18@e379451c7f
Reviewed-on: https://github.com/flang-compiler/f18/pull/749
2019-09-23 02:35:04 -07:00
Jean Perier cd15ba5360 [flang] Fix typos and style in some comments
Original-commit: flang-compiler/f18@621ded353f
Reviewed-on: https://github.com/flang-compiler/f18/pull/749
2019-09-18 08:04:52 -07:00
Jean Perier 00c02c469c [flang] Refactor IntrinsicProcTable::Implementation::Probe for readability
Original-commit: flang-compiler/f18@4a7211e42b
Reviewed-on: https://github.com/flang-compiler/f18/pull/749
Tree-same-pre-rewrite: false
2019-09-18 05:15:56 -07:00
Jean Perier 9a01a4915e [flang] Address editorial comments and use oxford comma
Original-commit: flang-compiler/f18@88a8d1be03
Reviewed-on: https://github.com/flang-compiler/f18/pull/749
Tree-same-pre-rewrite: false
2019-09-17 01:54:51 -07:00
Jean Perier d8fc41f612 [flang] Allow more argument types in some specific intrinsic
Fix flang-compiler/f18#724.
Allow all type kinds for arguments in restricted specific conversion
intrinisc (no warning, this is ubiquitous).
Allow MAX/MIN restricted intrinsic (AMAX0...) to be replaced by the
related generic foolowed by a type conversion to the expected result
type of the specific. Emit a warning because xlf and ifort are doing so
but pgfortran is converting the arguments instead.

Original-commit: flang-compiler/f18@c07adb94ed
Reviewed-on: https://github.com/flang-compiler/f18/pull/749
Tree-same-pre-rewrite: false
2019-09-16 09:34:10 -07:00
Tim Keith 3165e0b5b2 [flang] Merge pull request flang-compiler/f18#752 from flang-compiler/tsk-issue746
Handle alternative names for relational operators

Original-commit: flang-compiler/f18@c448c2b1a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/752
2019-09-19 15:36:04 -07:00
Tim Keith 493a135a56 [flang] Handle alternative names for relational operators
10.1.6.2 says:
> The operators <, <=, >, >=, ==, and /= always have the same interpretations
> as the operators .LT., .LE., .GT., .GE., .EQ., and .NE., respectively.
That means we have to treat `operator(<)` like `operator(.lt.)`,
for example. `<>` is a third alias for `.NE.`.

We can't just choose always to use one form (e.g. replacing `operator(.lt.)`
with `operator(<)`). This is because all symbols names are `CharBlock`s
referring to the cooked character stream so that they have proper source
provenance. Also, if a user prefers one style and uses it consistently,
that's the form they should see in messages.

So the fix is to use whatever form is found in the source, but also to
look up symbols by the other names when necessary. To assist this, add
`GenericSpecInfo::GetAllNames()` to return all of the names of a generic
spec. Each place a generic spec can occur we have to use these to look
for the symbol.

Also reorganize the `AddUse()` overloads to work with this change.

Fixes flang-compiler/f18#746.

Original-commit: flang-compiler/f18@7f06f175d5
Reviewed-on: https://github.com/flang-compiler/f18/pull/752
2019-09-19 15:18:33 -07:00
Tim Keith e525afbb21 [flang] Merge pull request flang-compiler/f18#754 from flang-compiler/tsk6
Clean up temp dirs

Original-commit: flang-compiler/f18@6e8f90127a
Reviewed-on: https://github.com/flang-compiler/f18/pull/754
2019-09-19 11:01:42 -07:00
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