1! { dg-do run } 2! PR 20074: This used to segfault at runtime. 3! Test case contributed by "Alfredo Buttari" <pitagoras@tin.it> 4 5program tryreshape 6 7 integer,allocatable :: vect1(:),resh1(:,:) 8 integer,pointer :: vect(:),resh(:,:) 9 integer :: vect2(2*4), resh2(2,4) 10 integer :: r, s(2) 11 12 r=2; nb=4 13 14 s(:)=(/r,nb/) 15 16 allocate(vect(nb*r),vect1(nb*r)) 17 allocate(resh(r,nb),resh1(r,nb)) 18 19 vect =1 20 vect1=1 21 vect2=1 22 23 resh2 = reshape(vect2,s) 24 if (resh2(1,1) /= 1.0) call abort 25 26 resh1 = reshape(vect1,s) 27 if (resh1(1,1) /= 1.0) call abort 28 29 resh = reshape(vect,s) 30 if (resh(1,1) /= 1.0) call abort 31 32end program tryreshape 33