diff options
author | Andre Vehreschild <vehre@gcc.gnu.org> | 2020-12-31 10:40:30 +0100 |
---|---|---|
committer | Andre Vehreschild <vehre@gcc.gnu.org> | 2024-07-18 10:07:23 +0200 |
commit | 18f3b223b97011c2eab71c8e48c3a38a12ff8f65 (patch) | |
tree | d0ea3d03e73bcf063b40d972b06d1936dae47faa /gcc/fortran/interface.cc | |
parent | e217e7dbdc1040e7ee160796e9ca1ef12a0dd1cb (diff) | |
download | gcc-18f3b223b97011c2eab71c8e48c3a38a12ff8f65.zip gcc-18f3b223b97011c2eab71c8e48c3a38a12ff8f65.tar.gz gcc-18f3b223b97011c2eab71c8e48c3a38a12ff8f65.tar.bz2 |
Fortran: Fix Explicit cobounds of a procedures parameter not respected [PR78466]
Explicit cobounds of class array procedure parameters were not taken
into account. Furthermore were different cobounds in distinct
procedure parameter lists mixed up, i.e. the last definition was taken
for all. The bounds are now regenerated when tree's and expr's bounds
do not match.
PR fortran/78466
PR fortran/80774
gcc/fortran/ChangeLog:
* array.cc (gfc_compare_array_spec): Take cotype into account.
* class.cc (gfc_build_class_symbol): Coarrays are also arrays.
* gfortran.h (IS_CLASS_COARRAY_OR_ARRAY): New macro to detect
regular and coarray class arrays.
* interface.cc (compare_components): Take codimension into
account.
* resolve.cc (resolve_symbol): Improve error message.
* simplify.cc (simplify_bound_dim): Remove duplicate.
* trans-array.cc (gfc_trans_array_cobounds): Coarrays are also
arrays.
(gfc_trans_array_bounds): Same.
(gfc_trans_dummy_array_bias): Same.
(get_coarray_as): Get the as having a non-zero codim.
(is_explicit_coarray): Detect explicit coarrays.
(gfc_conv_expr_descriptor): Create a new descriptor for explicit
coarrays.
* trans-decl.cc (gfc_build_qualified_array): Coarrays are also
arrays.
(gfc_build_dummy_array_decl): Same.
(gfc_get_symbol_decl): Same.
(gfc_trans_deferred_vars): Same.
* trans-expr.cc (class_scalar_coarray_to_class): Get the
descriptor from the correct location.
(gfc_conv_variable): Pick up the descriptor when needed.
* trans-types.cc (gfc_is_nodesc_array): Coarrays are also
arrays.
(gfc_get_nodesc_array_type): Indentation fix only.
(cobounds_match_decl): Match a tree's bounds to the expr's
bounds and return true, when they match.
(gfc_get_derived_type): Create a new type tree/descriptor, when
the cobounds of the existing declaration and expr to not
match. This happends for class arrays in parameter list, when
there are different cobound declarations.
gcc/testsuite/ChangeLog:
* gfortran.dg/coarray/poly_run_1.f90: Activate old test code.
* gfortran.dg/coarray/poly_run_2.f90: Activate test. It was
stopping before and passing without an error.
Diffstat (limited to 'gcc/fortran/interface.cc')
-rw-r--r-- | gcc/fortran/interface.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc index bf151da..b592fe4 100644 --- a/gcc/fortran/interface.cc +++ b/gcc/fortran/interface.cc @@ -518,12 +518,19 @@ compare_components (gfc_component *cmp1, gfc_component *cmp2, if (cmp1->attr.dimension != cmp2->attr.dimension) return false; + if (cmp1->attr.codimension != cmp2->attr.codimension) + return false; + if (cmp1->attr.allocatable != cmp2->attr.allocatable) return false; if (cmp1->attr.dimension && gfc_compare_array_spec (cmp1->as, cmp2->as) == 0) return false; + if (cmp1->attr.codimension + && gfc_compare_array_spec (cmp1->as, cmp2->as) == 0) + return false; + if (cmp1->ts.type == BT_CHARACTER && cmp2->ts.type == BT_CHARACTER) { gfc_charlen *l1 = cmp1->ts.u.cl; |