$ cat cshift-alloc.f90 program main implicit none integer, dimension (:,:),allocatable :: a integer, dimension (3) :: sh integer :: i allocate (a(3,3)) a = reshape((/(i,i=1,9)/),shape(a)) sh = (/ 2, -1, -2 /) write(*,fmt='(10I5)') cshift(a, shift=sh) end program main $ gfortran cshift-alloc.f90 $ ./a.out Segmentation fault $ nm ./a.out | grep shift U _gfortran_cshift1_4 Same thing for eoshift1 and eoshift3.
Subject: Bug 22144 CVSROOT: /cvs/gcc Module name: gcc Changes by: tkoenig@gcc.gnu.org 2005-06-25 09:56:38 Modified files: libgfortran : ChangeLog libgfortran/m4 : cshift1.m4 eoshift1.m4 eoshift3.m4 libgfortran/generated: cshift1_4.c cshift1_8.c eoshift1_4.c eoshift1_8.c eoshift3_4.c eoshift3_8.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: shift-alloc.f90 Log message: 2005-06-25 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/22144 * m4/cshift1.m4: Remove const from argument ret. Populate return array descriptor if ret->data is NULL. * m4/eoshift1.m4: Likewise. * m4/eoshift3.m4: Likewise. * generated/cshift1_4.c: Regenerated. * generated/cshift1_8.c: Regenerated. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2005-06-25 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/21144 * gfortran.dg/shift-alloc.f90: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.249&r2=1.250 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/cshift1.m4.diff?cvsroot=gcc&r1=1.7&r2=1.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/eoshift1.m4.diff?cvsroot=gcc&r1=1.8&r2=1.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/eoshift3.m4.diff?cvsroot=gcc&r1=1.8&r2=1.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/cshift1_4.c.diff?cvsroot=gcc&r1=1.6&r2=1.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/cshift1_8.c.diff?cvsroot=gcc&r1=1.6&r2=1.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift1_4.c.diff?cvsroot=gcc&r1=1.7&r2=1.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift1_8.c.diff?cvsroot=gcc&r1=1.7&r2=1.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift3_4.c.diff?cvsroot=gcc&r1=1.7&r2=1.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift3_8.c.diff?cvsroot=gcc&r1=1.7&r2=1.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5684&r2=1.5685 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/shift-alloc.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed on mainline, waiting for 4.0 to reopen.
Subject: Bug 22144 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: tkoenig@gcc.gnu.org 2005-07-14 21:17:44 Modified files: libgfortran : ChangeLog libgfortran/generated: cshift1_4.c cshift1_8.c eoshift1_4.c eoshift1_8.c eoshift3_4.c eoshift3_8.c libgfortran/intrinsics: eoshift0.c eoshift2.c libgfortran/m4 : cshift1.m4 eoshift1.m4 eoshift3.m4 gcc/testsuite : ChangeLog gcc/testsuite/gfortran.fortran-torture/execute: intrinsic_eoshift.f90 Added files: gcc/testsuite/gfortran.dg: shift-alloc.f90 Log message: 2005-07-14 Thomas Koenig <Thomas.Koenig@online.de> Backport from mainline. PR libfortran/21594 PR libfortran/22142 PR libfortran/22144 * intrinsics/eoshift0.c: If abs(shift) > len, fill the the whole array with the boundary value, but don't overrun it. * intrinsics/eoshift2.c: Likewise. * m4/eoshift1.m4: Likewise. * m4/eoshift3.m4: Likewise. * m4/eoshift1.m4: Correct bstride (it needs to be multiplied by size since it's a char pointer). * m4/eoshift3.m4: Likewise. * m4/cshift1.m4: Remove const from argument ret. Populate return array descriptor if ret->data is NULL. * m4/eoshift1.m4: Likewise. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2005-07-14 Thomas Koenig <Thomas.Koenig@online.de> Backport from mainline: PR libfortran/21594 PR libfortran/22144 PR libfortran/22142 * gfortran.fortran-torture/execute/intrinsic_eoshift.f90: Add test cases where the shift length is greater than the array length. Add test cases for PR 22142 for eoshift1 and eoshift3. * gfortran.dg/shift-alloc.f90: New testcase. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.163.2.61&r2=1.163.2.62 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/cshift1_4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/cshift1_8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift1_4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift1_8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift3_4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift3_8.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5.12.1&r2=1.5.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/eoshift0.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.9.12.1&r2=1.9.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/eoshift2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.9.12.1&r2=1.9.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/cshift1.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.6.12.1&r2=1.6.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/eoshift1.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.6.12.1&r2=1.6.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/eoshift3.m4.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.6.12.1&r2=1.6.12.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.276&r2=1.5084.2.277 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2&r2=1.2.46.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/shift-alloc.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.8.1
Fixed in 4.0.