[PATCH] Fortran: fix bogus bounds check for reallocation on assignment [PR116706]

Harald Anlauf anlauf@gmx.de
Wed Mar 19 22:08:58 GMT 2025


Dear all,

the attached patch addresses an actually very long-standing issue
with bogus bounds checks for components of nested derived types in
assignments when an intermediate level has the POINTER attribute
instead of the ALLOCATABLE attribute.  It turned out that the
check for a reallocatable lhs failed in such situations, as it
depended on an attribute that is currently not properly set.

I did not see a way to fix the alloc_comp attribute so that
it can deal with the current situation and decided to remove
that check in gfc_is_reallocatable_lhs.

Regtested on x86_64-pc-linux-gnu.  OK for mainline?

As this issue leads to wrong code, is it OK to backport
e.g. to 14-branch?

Thanks,
Harald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr116706.diff
Type: text/x-patch
Size: 2678 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20250319/4dece4ba/attachment-0001.bin>


More information about the Fortran mailing list