This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/29434] New: array bounds of allocatable components of derived types?
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Oct 2006 19:12:16 -0000
- Subject: [Bug fortran/29434] New: array bounds of allocatable components of derived types?
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code (derived from alloc_comp_constructor_1.f90):
! { dg-do run }
! { dg-options "-fdump-tree-original" }
! Test constructors of derived type with allocatable components (PR 20541).
!
! Contributed by Erik Edelmann <eedelmann@gcc.gnu.org>
! and Paul Thomas <pault@gcc.gnu.org>
!
Program test_constructor
implicit none
type :: thytype
integer(4) :: a(2,2)
end type thytype
type :: mytype
integer(4), allocatable :: a(:, :)
type(thytype), allocatable :: q(:)
end type mytype
type (mytype) :: x
type (thytype) :: foo = thytype(reshape ([43, 100, 54, 76], [2,2]))
integer :: y(0:1, -1:0) = reshape ([42, 99, 55, 77], [2,2])
x = mytype(y, [foo, foo])
if (.not.allocated(x%a) .or. .not.allocated(x%q)) call abort()
print *, 'y bounds'
print *, lbound(y)
print *, ubound(y)
print *, 'x%a bounds'
print *, lbound(x%a)
print *, ubound(x%a)
end program test_constructor
compiled with ifort or gfortran, it returns
y bounds
0 -1
1 0
x%a bounds
0 -1
1 0
while compiled with g95, it returns
y bounds
0 -1
1 0
x%a bounds
1 1
2 2
What is the "standard conforming" answer?
Dominique
--
Summary: array bounds of allocatable components of derived types?
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dominiq at lps dot ens dot fr
GCC build triplet: 4.2.0 20061009
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29434