http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49214

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-05-29 
11:00:42 UTC ---
AFAICT this PR is fixed by the patch in
http://gcc.gnu.org/ml/fortran/2011-05/msg00220.html , except may be for the
following test
program allocate_assign
   implicit none
   type label
      integer, allocatable :: parts(:)
   end type label
   type table
      type(label), allocatable :: headers(:)
   end type table
   integer, parameter :: ik8 = selected_int_kind(18)
   type(table) x1(1)
   type(table) t1
   type(table), allocatable :: x(:)
   integer k
   integer(ik8) s
   t1 = table([label([1])])
   x1 = [t1]
   s = 0
   do k = 1, 2
      write(*,*) "1> ", k,s
      call foo
      write(*,*) "2> ",k,s, size (x)
      call bar
   end do
   write(*,*) s
contains
   subroutine foo
      x = x1
   end subroutine
   subroutine bar
      s = s+x(2)%headers(2)%parts(2)
   end subroutine
end program allocate_assign

which gives a segmentation fault

[macbook] f90/bug% gfc pr47517_1.f90
[macbook] f90/bug% a.out
 1>            1                    0
 2>            1                    0           1

Backtrace for this error:
0   libgfortran.3.dylib                 0x0000000100005dd7
_gfortrani_show_backtrace + 55
1   ???                                 0x00007fff5fc0f131 0x0 +
140734799868209
2   a.out                               0x0000000100002280 MAIN__ + 2848
3   a.out                               0x0000000100002dd7 main + 54
4   a.out                               0x000000010000166c start + 52
5   ???                                 0x0000000000000001 0x0 + 1
Segmentation fault

Further testing pending. Thanks for the patch.

Reply via email to