Bug 65841: intrinsic re-assignment with recursive re-allocations

Damian Rouson damian@sourceryinstitute.org
Wed Apr 22 00:54:00 GMT 2015


Gfortran developers,

Apparently gfortran-compiled executable files generate a segmentation fault upon a second intrinsic assignment that leads to recursive automatic reallocations.    I just submitted the test case below in Bug Report 65841 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65841) based on this problem identified by Weiyuan Jiang (cc’d).  

Damian


$ cat realloc_alloc_comp_with_alloc_comp.f90 
type a
  real, allocatable :: f
end type
type b
  type(a), allocatable :: g
end type
type(b) c,d
c%g=a(1.) 
d=c       
d=c       ! seg fault with gfortran 5.0 Build 20150216
end
       
$ gfortran realloc_alloc_comp_with_alloc_comp.f90 

$ ./a.out

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7F3705ACEBB7
#1  0x7F3705ACDDB0
#2  0x7F3704FD949F
#3  0x7F370502654C
#4  0x400901 in MAIN__ at realloc_alloc_comp_with_alloc_comp.f90:0
Segmentation fault (core dumped)

$ gfortran --version
GNU Fortran (GCC) 5.0.0 20150216 (experimental)


More information about the Fortran mailing list