[Bug fortran/38324] New: Wrong lbound given to allocatable components
pault at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Nov 30 07:50:00 GMT 2008
This was identified in comment #13 of PR34143 and is not fixed by the patch for
that PR.
The problem of conversion shows up even without -fdefault-integer-8 along with
bound problems as shown by the following code:
integer, parameter :: ik=4
type :: struct
integer(4), allocatable :: ib(:)
end type struct
integer, parameter :: from=-1, to=2
integer(ik), allocatable :: ia(:)
type(struct) :: x
allocate(ia(from:to))
print *, 'bounds, full array ', lbound(ia), ubound(ia)
print *, 'bounds, full implicit section', lbound(ia(:)), ubound(ia(:))
print *, 'bounds, full explicit section', lbound(ia(from:to)),
ubound(ia(from:to))
print *, 'derived type, ik=', ik
x=struct(ia)
print *, 'bounds, full array ', lbound(x%ib), ubound(x%ib)
x=struct(ia(:))
print *, 'bounds, full implicit section', lbound(x%ib), ubound(x%ib)
x=struct(ia(from:to))
print *, 'bounds, full explicit section', lbound(x%ib), ubound(x%ib)
deallocate(ia)
end
with ik = 4, the ouput is:
bounds, full array -1 2
bounds, full implicit section 1 4
bounds, full explicit section 1 4
derived type, ik= 4
bounds, full array -1 2
bounds, full implicit section -1 2 <-- should not it be
1 4 as above?
bounds, full explicit section 1 4
with ik = 8:
...
derived type, ik= 8
bounds, full array 1 4 <--- should not it be
-1 2 as for ik = 4?
bounds, full implicit section 1 4
bounds, full explicit section 1 4
--
Summary: Wrong lbound given to allocatable components
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: pault at gcc dot gnu dot org
ReportedBy: pault at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38324
More information about the Gcc-bugs
mailing list