[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
Thu Dec 8 17:54:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68225
--- Comment #8 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Addendum :
$ cat zzp.f90
program p
type t
integer :: a
character(:), allocatable :: c
end type
type(t) :: x
x = t(a=1) ; print *, x%a, x%c
x = t(a=2, c=null()) ; print *, x%a, x%c
x = t(c=null(), a=3) ; print *, x%a, x%c
x = t(a=4, c='c4') ; print *, x%a, x%c
x = t(a=5) ; print *, x%a, x%c
x = t(6, 'c6') ; print *, x%a, x%c
x = t(c='c7', a=7) ; print *, x%a, x%c
x = t(c=null(), a=8) ; print *, x%a, x%c
x = t(9, c='c9') ; print *, x%a, x%c
x = t(10, null()) ; print *, x%a, x%c
x = t(11, 'c11') ; print *, x%a, x%c
x = t(12) ; print *, x%a, x%c
end
$ gfortran-7-20161204 -O2 zzp.f90
$ a.out
1
2
3
4 c4
5
6 c6
7 c7
8
9 c9
10
11 c11
12
Compiling with -O0 or -Og :
$ gfortran-7-20161204 -g -O0 -Wall -fcheck=all zzp.f90
$ a.out
1
2
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x2ad486c4711f in ???
#1 0x2ad486ca38ee in ???
#2 0x410f1a in list_formatted_write_scalar
at ../../../libgfortran/io/write.c:1887
#3 0x4023d7 in p
at .../zzp.f90:9
#4 0x402e53 in main
at .../zzp.f90:19
Segmentation fault
More information about the Gcc-bugs
mailing list