https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102043
Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sandra at codesourcery dot com --- Comment #15 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- One possibility would be to extend the patch Sandra posted at https://gcc.gnu.org/pipermail/fortran/2021-January/055563.html to scalarization. With the patch, the snippet integer :: i,j integer :: a(4, 4) do j=1,size(a,2) do i=1,size(a,1) a(i,j) = 0 end do end do is translated to while (1) { { logical(kind=4) D.4265; D.4265 = j > 4; if (D.4265) goto L.4; i = 1; while (1) { { logical(kind=4) D.4268; D.4268 = i > 4; if (D.4268) goto L.6; typedef integer(kind=4) [1:4]; typedef integer(kind=4) [1:4][1:4]; ((integer(kind=4)[1:4][1:4]) a)[(integer(kind=8)) j]{lb: 1 sz: 16}[(integer(kind=8)) i]{lb: 1 sz: 4} = 0; L.5:; i = i + 1; } } L.6:; L.3:; j = j + 1; } } which looks good.