https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91565
--- Comment #2 from kargl at gcc dot gnu.org --- (In reply to kargl from comment #1) > (In reply to G. Steinmetz from comment #0) > > ICE hits gfortran-8 and higher - this changed just before 20180525. > > Starting with correct code z0.f90, then providing wrong orders > > (accepted up to gfortran-7) : > > > > > > $ cat z0.f90 > > program p > > integer, parameter :: a(2) = [2,1] > > print *, reshape([1,2,3,4,5,6], [2,3], order=a) > > end > > > > $ gfortran-10 z0.f90 && ./a.out > > 1 4 2 5 3 6 > > > > > > > > $ cat z1.f90 # not a permutation > > program p > > integer, parameter :: a(2) = [2,2] > > print *, reshape([1,2,3,4,5,6], [2,3], order=a) > > end > > > > > > If I understand correctly, this is invalid because 'a' is > not a permutation of the [1, 2, ..., n] where n = size(shape). > I have a fix for this. Hmmm. This is messed up. check.c(gfc_check_reshape) is doing some of the work that is done in simplify.c(gfc__simplity_reshape). These two functions can probably use a rewrite to avoid duplication of effort.