Another corner case of eoshift that's not correct... in eoshift3, this time. $ cat eoshift.f90 program main implicit none integer, dimension (3,3) :: a, b, w integer, dimension (3) :: bo, sh integer :: i,j a = reshape((/(i,i=1,9)/),shape(a)) sh = (/ 3, -1, -3 /) bo = (/-999, -99, -9 /) b = eoshift(a, shift=sh, boundary=bo) w = reshape((/ -999, -999, -999, -99, 4, 5, -9, -9, -9 /), shape(b)) do j=1,3 do i=1,3 if (w(i,j) /= b(i,j)) print *,i,j,w(i,j),b(i,j) end do end do end program main $ gfortran eoshift.f90 $ ./a.out 1 2 -99 -1644167172 1 3 -9 -6422529 2 3 -9 -6422529 3 3 -9 -6422529 $ gfortran -v Using built-in specs. Target: ia64-unknown-linux-gnu Configured with: ../gcc-4.1-20050618/configure --prefix=/home/zfkts --enable- languages=c,f95 Thread model: posix gcc version 4.1.0 20050618 (experimental) $ nm a.out | grep eoshift U _gfortran_eoshift3_4
Created attachment 9156 [details] Proposed patch.
Comment on attachment 9156 [details] Proposed patch. The patch was for the wrong bug report *sigh*.
This is missing: *** eoshift3.m4 2005-06-27 14:05:51.000000000 +0200 --- /home/zfkts/gcc-maint/libgfortran/m4/eoshift3.m4 2005-06-27 11:47:13.000000000 +0200 *************** *** 136,142 **** hstride[n] = h->dim[n].stride; if (bound) ! bstride[n] = bound->dim[n].stride * size; else bstride[n] = 0; n++; --- 136,142 ---- hstride[n] = h->dim[n].stride; if (bound) ! bstride[n] = bound->dim[n].stride; else bstride[n] = 0; n++;
Actually, the patch should be the other way around.
Subject: Bug 22142 CVSROOT: /cvs/gcc Module name: gcc Changes by: tkoenig@gcc.gnu.org 2005-06-28 21:57:45 Modified files: libgfortran : ChangeLog libgfortran/generated: eoshift3_4.c eoshift3_8.c libgfortran/m4 : eoshift3.m4 gcc/testsuite : ChangeLog gcc/testsuite/gfortran.fortran-torture/execute: intrinsic_eoshift.f90 Log message: 2005-06-28 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/22142 * m4/eoshift3.m4: Correct bstride (it needs to be multiplied by size since it's a char pointer). * m4/eoshift3_4.c: Regenerated. * m4/eoshift3_8.c: Regenerated. 2005-06-28 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/22142 * gfortran.fortran-torture/execute/intrinsic_eoshift.f90: Add testcase for PR 22142. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.252&r2=1.253 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift3_4.c.diff?cvsroot=gcc&r1=1.8&r2=1.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift3_8.c.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.9&r2=1.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5699&r2=1.5700 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90.diff?cvsroot=gcc&r1=1.2&r2=1.3
Subject: Bug 22142 CVSROOT: /cvs/gcc Module name: gcc Changes by: tkoenig@gcc.gnu.org 2005-06-28 23:07:22 Modified files: libgfortran : ChangeLog libgfortran/generated: eoshift1_4.c eoshift1_8.c libgfortran/m4 : eoshift1.m4 gcc/testsuite : ChangeLog gcc/testsuite/gfortran.fortran-torture/execute: intrinsic_eoshift.f90 Log message: 2005-06-28 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/22142 * m4/eoshift1.m4: Correct bstride (it needs to be multiplied by size since it's a char pointer). * m4/eoshift1_4.c: Regenerated. * m4/eoshift1_8.c: Regenerated. 2005-06-28 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/22142 * gfortran.fortran-torture/execute/intrinsic_eoshift.f90: Add testcase also testing eoshift1 for PR 22142. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.253&r2=1.254 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift1_4.c.diff?cvsroot=gcc&r1=1.8&r2=1.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/eoshift1_8.c.diff?cvsroot=gcc&r1=1.8&r2=1.9 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/eoshift1.m4.diff?cvsroot=gcc&r1=1.9&r2=1.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5701&r2=1.5702 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_eoshift.f90.diff?cvsroot=gcc&r1=1.3&r2=1.4
Fixed on 4.1, waiting for 4.0 to reopen.
Subject: Bug 22142 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.