https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124661

--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to Christopher Albert from comment #6)
> Created attachment 64069 [details]
> Replacement patch covering comment #4 variant
> 
> Replacement patch attached. This keeps descriptor factoring local to the
> saved expression so bounds checks do not rewrite shared trees and use
> temporaries before initialization. It covers the nested component-array
> variant from comment 4 as well as the original reproducer. Validation on
> 2026-03-29: the comment-4 variant now runs clean with -fcheck=bounds, make
> check-gfortran RUNTESTFLAGS="dg.exp=pr124661.f90" passes, make
> check-gfortran RUNTESTFLAGS="dg.exp=assign_14.f90" passes, make -j32 -k
> check-gfortran finishes with 0 FAIL / XPASS, and make -j32
> check-target-libgomp-fortran shows no FAIL / XPASS.

Interesting.  You are solving it with a walk over the array descriptor
reference to recursively copy it, whereas I was solving it with a walk over the
bound check code to detect shared trees.

This variant looks good, but you no longer need the saved_prior_ref business,
do you?

Reply via email to