Am 19.03.25 um 23:25 schrieb Steve Kargl:
On Wed, Mar 19, 2025 at 11:08:58PM +0100, Harald Anlauf wrote:

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?

OK.

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

Yes, fixing wrong-code bugs can/should be backported.

Alright, pushed as r15-8453-g3292ca9b0818c3 so far.

One question below.

+program testprog
+  implicit none
+
+  type :: data_node
+     integer, allocatable :: data(:)
+  end type data_node

data is of type integer.

+  allocate (starlist%nodes(2))
+  starlist%nodes(1)%data = [1., 2., 3.]

Is the floating-point conversion testing some aspect
of the bugfix that I don't see?

There's no conversion happening for a class(*) lhs,
which I have also checked (manually).  I could have used
character or logical in the rhs constructor instead...
Not important, though.

Thanks for the review!

Harald

Reply via email to