This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/18899] New: gfortran/libfortran(?): ubound wrongly calculated for passed array
- From: "anlauf at hep dot tu-darmstadt dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Dec 2004 08:50:18 -0000
- Subject: [Bug fortran/18899] New: gfortran/libfortran(?): ubound wrongly calculated for passed array
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
the following code snippet shows that gfortran calculates
the upper bound wrong when the lower bound is not 1.
(If this a bug in libfortran, please adjust the subject.)
module gfcbug22
implicit none
contains
subroutine foo (a)
integer :: a(0:)
if (lbound (a, dim=1) /= 0 .or. ubound (a, dim=1) /= 1) then
print *, "Fail!"
print '(1x,a,i2,a,i2)', &
"lbound =", lbound (a, dim=1), ", ubound =", ubound (a, dim=1)
end if
end subroutine foo
end module gfcbug22
program gfctest22
use gfcbug22
implicit none
integer :: a(0:1)
! It is apparently ok here...
! print '(1x,a,i2,a,i2)', &
! "lbound =", lbound (a, dim=1), ", ubound =", ubound (a, dim=1)
call foo (a)
end program gfctest22
Compiling & running, I get:
Fail!
lbound = 0, ubound = 2
Cheers,
-ha
--
Summary: gfortran/libfortran(?): ubound wrongly calculated for
passed array
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: anlauf at hep dot tu-darmstadt dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18899