[PATCH] Fortran: fix issues with rank-2 deferred-length character arrays [PR108581]
Harald Anlauf
anlauf@gmx.de
Sat Sep 20 20:34:23 GMT 2025
Dear All,
the attached patch is the result of several long debugging sessions
trying to find out why deferred-length character arrays were mistreated.
It turned out that when deriving the dataptr offset in the array
descriptor, for fixed length the element size takes into account the
known string length, while for deferred-length it is taken from the
underlying type. We thus need to fix that and multiply the offset by
the length.
While developing the testcase, I noticed that not only write statements
are affected by this issue as in the original PR, but also pointer
association. I thus tried to exercise positive and negative and
non-unit strides.
Testcase cross-checked with NAG. And it runs clean under valgrind. ;-)
Regtested on x86_64-pc-linux-gnu. OK for mainline?
And if it survives for some time, backport to 15-branch?
Thanks,
Harald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr108581.diff
Type: text/x-patch
Size: 8425 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20250920/5f0b71d3/attachment-0003.bin>
More information about the Fortran
mailing list