https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69739
Harald Anlauf <anlauf at gmx dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gmx dot de --- Comment #3 from Harald Anlauf <anlauf at gmx dot de> --- (In reply to John from comment #2) > After reporting the bug, I noticed that in the actual code I have (not the > reduced version I posted before), adding the (:) stride doesn't always make > the ICE go away. > > What solved the problem once and for all (and without using the > -fno-realloc-lhs flag) was changing the result in the "operate" function to > be that of an allocatable array: > > function operate(A, X) > type(sometype), intent(IN) :: A(:,:,:) > real, intent(IN) :: X(:) > ! real :: operate(1:PRODUCT(UBOUND(A))) > real, allocatable :: operate(:) > > allocate (operate(1:PRODUCT(UBOUND(A)))) > operate(:) = 0 > end function > > So maybe the automatic-size result is the actual root of the ICE? If I use real :: operate(1:size(A)) instead of real :: operate(1:PRODUCT(UBOUND(A))) I do not get an ICE. So it's not automatic-size per se.