diff options
author | Harald Anlauf <anlauf@gmx.de> | 2024-03-12 22:58:39 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2024-03-13 18:41:20 +0100 |
commit | 11caf47b599568c6c6f5a12cf8e21f50778176d3 (patch) | |
tree | d113740dda5d8135387198cf62e85c03e588ab56 /gcc/fortran/expr.cc | |
parent | 74bca21db31e3f4ab6543b56c3f26b4dfe586fef (diff) | |
download | gcc-11caf47b599568c6c6f5a12cf8e21f50778176d3.zip gcc-11caf47b599568c6c6f5a12cf8e21f50778176d3.tar.gz gcc-11caf47b599568c6c6f5a12cf8e21f50778176d3.tar.bz2 |
Fortran: fix IS_CONTIGUOUS for polymorphic dummy arguments [PR114001]
gcc/fortran/ChangeLog:
PR fortran/114001
* expr.cc (gfc_is_simply_contiguous): Adjust logic so that CLASS
symbols are also handled.
gcc/testsuite/ChangeLog:
PR fortran/114001
* gfortran.dg/is_contiguous_4.f90: New test.
Diffstat (limited to 'gcc/fortran/expr.cc')
-rw-r--r-- | gcc/fortran/expr.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index 37ea95d..82a642b 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -6025,15 +6025,16 @@ gfc_is_simply_contiguous (gfc_expr *expr, bool strict, bool permit_element) } sym = expr->symtree->n.sym; - if (expr->ts.type != BT_CLASS - && ((part_ref - && !part_ref->u.c.component->attr.contiguous - && part_ref->u.c.component->attr.pointer) - || (!part_ref - && !sym->attr.contiguous - && (sym->attr.pointer - || (sym->as && sym->as->type == AS_ASSUMED_RANK) - || (sym->as && sym->as->type == AS_ASSUMED_SHAPE))))) + if ((part_ref + && part_ref->u.c.component + && !part_ref->u.c.component->attr.contiguous + && IS_POINTER (part_ref->u.c.component)) + || (!part_ref + && expr->ts.type != BT_CLASS + && !sym->attr.contiguous + && (sym->attr.pointer + || (sym->as && sym->as->type == AS_ASSUMED_RANK) + || (sym->as && sym->as->type == AS_ASSUMED_SHAPE)))) return false; if (!ar || ar->type == AR_FULL) |