[Bug fortran/46339] [4.3/4.4/4.5/4.6 Regression] ICE (segfault) in gfc_trans_pointer_assignment

jvdelisle at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 19 18:02:00 GMT 2010


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

--- Comment #19 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-19 17:42:12 UTC ---
Another test case to think about. Ifort compiles but gives:

        ptr =
    myA%i%j =           1           2           3           4

gfortran compiles and gives:

$ ./a.out 
Segmentation fault (core dumped)

$ gfc -fbounds-check test3.f90
$ ./a.out 
At line 19 of file test3.f90
Fortran runtime error: Array bound mismatch for dimension 1 of array 'ptr'
(140251380424698/4)

Is there something invalid here?

module test
  implicit none
  type b
    integer :: j
    character :: c
  end type b
  type a
    type(b), dimension(4) :: i
  end type a
end module test

program main
  use test
  implicit none
  type(a), target :: myA
  integer, dimension(:), pointer :: ptr
  myA%i(1:4)%j = (/ 1, 2, 3, 4 /)
  myA%i(1:4)%c = (/ 'a', 'b', 'c', 'd' /)
  ptr = myA%i%j
  print *, "       ptr =", ptr
  print *, "   myA%i%j =", myA%i%j
end program main



More information about the Gcc-bugs mailing list