https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124661
--- Comment #3 from Christopher Albert <albert at tugraz dot at> --- Created attachment 64058 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64058&action=edit Proposed patch Proposed patch attached. Reproduced on current trunk. The fix keeps the saved descriptor reference alive across the INDIRECT_REF walk in set_factored_descriptor_value and then uses that factored descriptor for the later data and offset accesses in gfc_conv_ss_descriptor. The reproducer now runs clean with -fcheck=bounds. I also reran make check-gfortran RUNTESTFLAGS="dg.exp=pr124661.f90", make check-gfortran RUNTESTFLAGS="dg.exp=assign_14.f90", and a full check-gfortran run with 0 FAIL / XPASS.
