https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109948
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org --- Comment #6 from anlauf at gcc dot gnu.org --- (In reply to Rimvydas (RJ) from comment #5) > (In reply to anlauf from comment #4) > > Can you check if this works for you? > > This patch allows to avoid issue on all other associate use cases (tried on > gcc-13 branch). > > However it is a bit suspicious that using variable name abbreviations (to > dig out arrays from deeply nested types) is enough to change how the > internal gfc_array_ref is populated. ICE was triggered only on patterns > involving first using abbreviated name indexed access (like k(1)) followed > by any operation involving whole array. I agree that this patch is a band-aid, possibly for some latent issue. The suspect patch may have affected the order of resolution. Note that replacing in the reduced testcase in comment#3: associate(k=>k_2d) by associate(k=>k_2d(:)) avoids the ICE and gives identical code for gcc-12 .. gcc-14. In fact, the array-spec seems properly set. I've added Paul in CC, who is more familiar with the associate construct.