Hi Andre,
Am 20.08.24 um 13:52 schrieb Andre Vehreschild:
Hi all,
attached patch fixes an ICE in gimplify by assuring that the corank of a
non-pointer, non-coarray array component in a derived type is zero. Previously
(erroneously) the full corank of the type has been used. There is one exception
for pointer typed array components in coarray derived types. These can be
associated only to coarray array targets (compare F2018 C1024 and C1026).
Therefore for those the corank is still propagated.
the patch is OK for mainline, but the formatting violates the coding
style here:
@@ -2909,12 +2909,14 @@ gfc_get_derived_type (gfc_symbol * derived, int
codimen)
else
akind = GFC_ARRAY_ALLOCATABLE;
/* Pointers to arrays aren't actually pointer types. The
- descriptors are separate, but the data is common. */
- field_type = gfc_build_array_type (field_type, c->as, akind,
- !c->attr.target
- && !c->attr.pointer,
- c->attr.contiguous,
- codimen);
+ descriptors are separate, but the data is common. Every
+ array pointer in a coarray derived type needs to provide space
+ for the coarray management, too. Therefore treat coarrays
+ and pointers to coarrays in derived types the same. */
+ field_type = gfc_build_array_type (
^^^
Please move this opening parenthesis to the next line,
otherwise the indenting with emacs goes sideways.
+ field_type, c->as, akind, !c->attr.target && !c->attr.pointer,
+ c->attr.contiguous,
+ c->attr.codimension || c->attr.pointer ? codimen : 0);
}
else
field_type = gfc_get_nodesc_array_type (field_type, c->as,
Thanks,
Harald
Regtests ok on x86_64-pc-linux-gnu / Fedora 39. Ok for mainline?
Regards,
Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de