This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/35685] New: UBOUND incorrect for run-time zero-sized section
- From: "dick dot hendrickson at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2008 21:08:05 -0000
- Subject: [Bug fortran/35685] New: UBOUND incorrect for run-time zero-sized section
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following program gives the wrong value for the UBOUND
function on a zero sized array. It looks correct for constant
section subscripts, but incorrect for run-time expressions.
The related functions, LBOUND, SHAPE, and SIZE are correct.
Dick Hendrickson
C:\g_experiments\gfortran>gfortran ja0045.f
C:\g_experiments\gfortran>a
UBOUND ZDA1= 0 -5 -1
-----------------------------------------------
program try_ja0045
call ja0045(3,-3,7,1,6)
end program
SUBROUTINE JA0045(nf3,mf3,nf7,nf1,nf6)
INTEGER IDA(3)
real ZDA1(3:10,4:10,5:10)
IDA = UBOUND(ZDA1(3:2, NF3:MF3, NF7+NF1:NF6))
if ( any(ida .ne. (/0,0,0/)) ) print *, 'UBOUND ZDA1=',ida
IDA = LBOUND(ZDA1(3:2, NF3:MF3, NF7+NF1:NF6))
if ( any(ida .ne. (/1,1,1/)) ) print *, 'LBOUND =',ida
IDA = SHAPE(ZDA1(3:2, NF3:MF3, NF7+NF1:NF6))
if ( any(ida .ne. (/0,0,0/)) ) print *, 'SHAPE =',ida
J = SIZE(ZDA1(3:2, NF3:MF3, NF7+NF1:NF6))
if ( j .ne. 0 ) print *, 'SIZE =',j
END SUBROUTINE
--
Summary: UBOUND incorrect for run-time zero-sized section
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dick dot hendrickson at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35685