[Bug fortran/68225] ICE with -Wrealloc-lhs-all on structure constructor with allocatable scalar component(s)
gerhard.steinmetz.fortran@t-online.de
gcc-bugzilla@gcc.gnu.org
Mon Nov 9 19:03:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68225
--- Comment #5 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
$ cat yy0.f90
program p
type t
integer, allocatable :: a(:)
end type
type(t) :: x
x = t()
print *, allocated(x%a), x%a
end
$ gfortran -g -O0 -Wall -fcheck=all yy0.f90
$ a.out
F
---
$ cat yy1.f90
program p
type t
integer, allocatable :: a(:)
end type
type(t) :: x
x = t([1, 2])
print *, allocated(x%a), x%a
end
$ gfortran -g -O0 -Wall -fcheck=all yy1.f90
$ a.out
T 1 2
---
$ cat zz0.f90
program p
type t
integer, allocatable :: a(:)
end type
type, extends(t) :: t2
integer, allocatable :: b(:)
end type
type(t2) :: x
x = t2()
print *, allocated(x%a), x%a
print *, allocated(x%b), x%b
end
$ gfortran -g -O0 -Wall -fcheck=all zz0.f90
$ a.out
F
F
---
$ cat zz1.f90
program p
type t
integer, allocatable :: a(:)
end type
type, extends(t) :: t2
integer, allocatable :: b(:)
end type
type(t2) :: x
x = t2([1])
print *, allocated(x%a), x%a
print *, allocated(x%b), x%b
end
$ gfortran -g -O0 -Wall -fcheck=all zz1.f90
$ a.out
T 1
F
---
$ cat zz2.f90
program p
type t
integer, allocatable :: a(:)
end type
type, extends(t) :: t2
integer, allocatable :: b(:)
end type
type(t2) :: x
x = t2(null(), [1, 2])
print *, allocated(x%a), x%a
print *, allocated(x%b), x%b
end
$ gfortran -g -O0 -Wall -fcheck=all zz2.f90
$ a.out
F
T 1 2
More information about the Gcc-bugs
mailing list