Type-bound generic statements can have binding names that refer to
bindings that occur later in the type. So save a map of generic to
binding names and process them when we get to the end of the
type-bound procedure part. This is similar to how specific procedures
of generic identifiers are handled.
Also detect duplicate binding names for a type-bound generic.
Fixes issue flang-compiler/f18#572.
Original-commit: flang-compiler/f18@d58bb77cfa
Reviewed-on: https://github.com/flang-compiler/f18/pull/577
* The warning was already here, this commit only refactors things so that
it can be controled with -Mstandard.
* Also makes the warning point to the do-stmt and adds a note to the warning
pointing to the statements where it ends.
Original-commit: flang-compiler/f18@11e1eb6edd
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
- Only allow out-of-scope label target for label-do-stmt
when the label is on an end-stmt of a scope directly nested
into the one of the label-do-stmt.
- Also transform label-do-stmt into non-label-do constructs
so that later phases do not have to handle label-do-stmt.
Original-commit: flang-compiler/f18@91cff2f296
Reviewed-on: https://github.com/flang-compiler/f18/pull/552
Tree-same-pre-rewrite: false
Change test scripts so that cmake passes in the path to the `f18`
that it just built. They no longer have to use relative paths.
Simplify argument passing in test scripts by sharing it in `common.sh`.
Move `if_arith01.f90`, `if_construct01.f90`, `if_stmt01.f90` to `ERROR_TESTS`.
As it was, nothing was being tested on them.
For `test_error.sh`, find the include directory relative to `f18` and
pass that in with a `-I` option. Eliminate the temporary definitions of
`iso_fortran_env`, `iso_c_binding`, `ieee_exceptions` in the tests
because the "real" ones are now available.
The tests that are run with `test_any.sh` could probably have similar
changes, but they are not part of this commit.
Original-commit: flang-compiler/f18@b62fe489be
Reviewed-on: https://github.com/flang-compiler/f18/pull/568
Generic operators and assignment have different rules than generic
names for their procedures being distinguishable.
Implement those rules in `DistinguishableOpOrAssign`. The rules are
considerably simpler: they must have the name number of dummy arguments
and at least one pair in the same position must be distinguishable.
Fixes issue flang-compiler/f18#563.
Original-commit: flang-compiler/f18@276bb08206
Reviewed-on: https://github.com/flang-compiler/f18/pull/576
Complete the checks for distinguishable specifics procedure in a generic
by considering any passed-object dummy arguments.
C1514 rule 3 is implemented and the checks for the other rules are
extended to consider the PASS attribute, including the concept of the
"effective" position of an argument in an argument list, computed by
ignoring passed-object arguments.
Add `pass` to `characteristics::DummyArgument` to mark each
passed-object dummy argument.
Change symbols to store the index of the passed-object dummy argument
rather than its symbol.
Check that specifics of a type-bound generic are distinguishable only
after all of the procedure bindings have been processed. They don't have
to be before the generic.
Original-commit: flang-compiler/f18@2751490f95
Reviewed-on: https://github.com/flang-compiler/f18/pull/567
* Examples of Composite and Combined constructs
2.8.3 Loop SIMD Construct
2.11.1 Parallel Loop Construct
2.11.3 Parallel Loop SIMD Construct
Not in the implementation:
2.8.3 DO SIMD: A list item may appear in a linear or firstprivate clause but not both
Original-commit: flang-compiler/f18@75d9c1a081
Reviewed-on: https://github.com/flang-compiler/f18/pull/558
In `OrderParameterNames` and `OrderParameterDeclarations` it was
always true that `this == &type.get<DerivedTypeDetails>()` which
meant that `this` was redundant.
So convert them to non-member functions in `tools.h` that get the
details from the symbol passed in. This makes life simpler for the
callers.
Original-commit: flang-compiler/f18@81710d4e6e
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Move these functions from scope.cc, symbol.cc, type.cc into tools.cc:
Scope::FindOrInstantiateDerivedType
Scope::InstantiateDerivedType
Scope::InstantiateIntrinsicType
Symbol::Instantiate
DerivedTypeSpec::ProcessParameterExpressions
DerivedTypeSpec::Instantiate
This eliminates some dependencies in these files on SemanticsContext,
FoldingContext, etc.
It also allows three of the functions to be private to tools.cc
because they are only called from the others.
Original-commit: flang-compiler/f18@48c6efbf95
Reviewed-on: https://github.com/flang-compiler/f18/pull/559
Tree-same-pre-rewrite: false
- Changed the name a a function to FindOrDeclareEnclosingEntity
- Changed that function to return a reference rather than a pointer
- Polished the setting of the IMPLICIT flag on a declared entity in a
locality-spec
- Changed a test to remove an unreported error
Original-commit: flang-compiler/f18@0c1a00d7c2
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false
Prior to this change, the compiler issued an error message when a name in a
SHARED locality-spec had not been declared explicitly in an enclosing scope.
Presumably, this was done to enforce constraint C1124. This constraint states
that "A variable-name in a locality-spec shall be the name of a variable in the
innermost executable construct or scoping unit that includes the DO CONCURRENT
statement". For LOCAL and LOCAL_INIT locality-spec's, we were automatically
creating a local variable in the situation where one had not been explicitly
declared rather than issuing an error message.
The only compiler I could find that implements the SHARED locality-spec was the
PGI compiler, which automatically creates a variable and does not emit an error
message. Also, @vdonaldson said that he had consulted with a member of the
Fortran standards committee who said that the correct thing was to create a
variable if necessary.
This change has the compiler creating a variable in the enclosing scope of a DO
CONCURRENT statement if necessary. I also changed a test to adapt to the new
behavior. I also consolidated the semantic checking for the constraints
associated with all of the locality-spec's.
Original-commit: flang-compiler/f18@d9253a76fc
Reviewed-on: https://github.com/flang-compiler/f18/pull/551
Tree-same-pre-rewrite: false