Commit graph

2511 commits

Author SHA1 Message Date
Steve Scalpone 0e3b30489c [flang] Merge pull request flang-compiler/f18#750 from DavidTruby/teams
Semantic checks for OpenMP teams directive

Original-commit: flang-compiler/f18@4b2a8be379
Reviewed-on: https://github.com/flang-compiler/f18/pull/750
2019-09-25 15:16:18 -07:00
David Truby 5efbea87cf [flang] Added grammar for teams directive to semantic checks
Original-commit: flang-compiler/f18@1cee26516b
Reviewed-on: https://github.com/flang-compiler/f18/pull/750
2019-09-19 10:02:35 +01:00
David Truby cad44d2e91 [flang] Semantic checks for teams directive
Original-commit: flang-compiler/f18@ec22e9c4c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/750
Tree-same-pre-rewrite: false
2019-09-17 12:08:04 +01:00
Steve Scalpone 914e93681a [flang] Merge pull request flang-compiler/f18#751 from flang-compiler/sjs-style-update
Update C++style.md

Original-commit: flang-compiler/f18@ab0cce1546
Reviewed-on: https://github.com/flang-compiler/f18/pull/751
2019-09-25 14:59:58 -07:00
Steve Scalpone fdb58597e8 [flang] Update C++style.md
Original-commit: flang-compiler/f18@d453fdda31
Reviewed-on: https://github.com/flang-compiler/f18/pull/751
2019-09-17 17:07:06 -07:00
Steve Scalpone 3a25e25bd7 [flang] Update C++style.md
Add guidelines for error messages and commas.  Add a version number for clang-format. Add spaces before ### sections to restart numbering.

Original-commit: flang-compiler/f18@3e8db49f34
Reviewed-on: https://github.com/flang-compiler/f18/pull/751
Tree-same-pre-rewrite: false
2019-09-17 12:31:37 -07:00
Tim Keith fc3c6ee607 [flang] Merge pull request flang-compiler/f18#758 from flang-compiler/tsk-modfiles
Improve module file reading and writing

Original-commit: flang-compiler/f18@b5f48dfc46
Reviewed-on: https://github.com/flang-compiler/f18/pull/758
2019-09-25 14:55:40 -07:00
Tim Keith 3ef61ec226 [flang] Fix tests that use the same .mod file
The tests run by `test_any.sh` don't redirect their .mod files to
a different directory so they occasionally fail when the same file
is accessed by different tests at the same time. With locking of
module files implemented, this problem reproduces much more reliably

Work around it by changing the module names to be distinct. Also remove
some comments left over when copied from `test_symbols.sh` tests.

Original-commit: flang-compiler/f18@f7b5c5f0fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/758
2019-09-25 14:55:40 -07:00
Tim Keith 73c630a4ea [flang] Improve module file reading and writing
Fix problems with writing a mod file while another compilation is
reading or writing. Write to a temp and then rename it:
- compute the new contents of the .mod file
- if it already exists, check if it is already correct
- if not, write new contents to a temp file
- rename the temp to the final destination

`mkstemps()` seems to be the best way to create the temp file.
It returns a file descriptor, so change the rest of the mod file
writing to use POSIX open/read/write/close. This seems to set
errno more reliably too.

There is some extra work around creating the temp to make it have
the same directory and suffix as the final file (so that if one gets
left behind by a crash, "rm *.mod" still cleans it up).
`mkstemps()` creates file with 0600 permissions so try to change it
to what it would have been if we just wrote the file.

Change module file reading to only read the file once; we used to
read it to verify the checksum and then again to parse it.
Instead, change `Parsing` so that we can get the file contents
after `Prescan()` and use that to verify the checksum. Also, it has
a mechanism for searching directories for files, so make use of that
instead of duplicating that functionality in `ModFileReader`.
This requires some changes to how errors are returned so they can
be reported in the right place.

Original-commit: flang-compiler/f18@d0d54971a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/758
Tree-same-pre-rewrite: false
2019-09-25 14:55:40 -07:00
Peter Klausler 42c1c21300 [flang] Merge pull request flang-compiler/f18#760 from flang-compiler/pmk-fix-build
Fix build on OSX

Original-commit: flang-compiler/f18@61dcae3442
Reviewed-on: https://github.com/flang-compiler/f18/pull/760
2019-09-25 10:57:24 -07:00
peter klausler 55e241a722 [flang] Fix build on OSX
Original-commit: flang-compiler/f18@453b03af1c
Reviewed-on: https://github.com/flang-compiler/f18/pull/760
2019-09-25 10:40:01 -07:00
Peter Klausler b80a8dcc1f [flang] Merge pull request flang-compiler/f18#755 from flang-compiler/pmk-spec-expr
Check specification expression constraints (10.1.11)

Original-commit: flang-compiler/f18@0c99f8dc8e
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
2019-09-25 09:23:29 -07:00
peter klausler ccb91afba7 [flang] Address review comments
Original-commit: flang-compiler/f18@2393157d3f
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
2019-09-25 09:04:38 -07:00
peter klausler 9fd72e9393 [flang] Clean up test results
Original-commit: flang-compiler/f18@7d3180160c
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:37 -07:00
peter klausler d8c9b50fd6 [flang] Prep for review
Original-commit: flang-compiler/f18@8be02a41c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/755
Tree-same-pre-rewrite: false
2019-09-25 09:04:35 -07:00
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