Reported by Clive Page, http://gcc.gnu.org/ml/fortran/2009-01/msg00335.html Fails with gfortran 4.1, 4.2, 4.3 and 4.4, but works with NAG f95, g95, ifort (9.1, 11.0), openf95. The proper result of the test program is: ------------------------------------------ normal 1 2 3 4 10 20 30 40 100 200 300 400 y-inverted 100 200 300 400 <<<<<<< These lines 10 20 30 40 <<<<<<< are missing 1 2 3 4 <<<<<<< with gfortran ------------------------------------------ The program: !----------------------------------------- module testy_mod implicit none contains subroutine mysub(text, array) character(len=*), intent(in) :: text integer, intent(in) :: array(:,:) integer :: j print *, text do j = 1, ubound(array,2) print '(10000i4)', array(:,j) end do end subroutine mysub end module testy_mod program testy use testy_mod implicit none integer, parameter :: nx = 4, ny = 3 integer :: array(nx,ny) data array / 1,2,3,4, 10,20,30,40, 100,200,300,400 / call mysub('normal', array) call mysub('y-inverted', array(:,ny:1:-1)) end program
This is the same as PR38852 and the fix for that one works for this too. Paul *** This bug has been marked as a duplicate of 38852 ***
Subject: Bug 39006 Author: pault Date: Wed Jan 28 21:48:53 2009 New Revision: 143743 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143743 Log: 2009-01-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/38852 PR fortran/39006 * trans-intrinsic.c (gfc_conv_intrinsic_bound): Use the array descriptor ubound for UBOUND, when the array lbound == 1. 2009-01-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/38852 PR fortran/39006 * gfortran.dg/bound_6.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/bound_6.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 39006 Author: pault Date: Thu Feb 19 06:43:15 2009 New Revision: 144286 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144286 Log: 2009-02-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38852 PR fortran/39006 * trans-intrinsic.c (gfc_conv_intrinsic_bound): Use the array descriptor ubound for UBOUND, when the array lbound == 1. 2009-02-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38852 PR fortran/39006 * gfortran.dg/bound_6.f90: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/bound_6.f90 Modified: branches/gcc-4_3-branch/gcc/fortran/ChangeLog branches/gcc-4_3-branch/gcc/fortran/trans-intrinsic.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog