Found while looking again as PR 39304. The following program causes an ICE. It
might well be only fixable with the new array descriptor.

The program works with 4.1 and 4.2 (which might well be only by chance) but
fails with 4.3/4.4/4.5 with:

test.f90: In function 'func':
test.f90:7:0: internal compiler error: Segmentation fault

Program received signal SIGSEGV, Segmentation fault.
0x000000000055d935 in gfc_trans_pointer_assignment (expr1=0x137b4e0,
expr2=0x137b970) at /home/tob/projects/gcc/gcc/fortran/trans-expr.c:4676
4676                  gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp);


module m
  implicit none
  type t
    real :: a(3)
  end type t
contains
  function func(x,i)
    type(t), target :: x(:)
    integer :: i
    real, dimension(:), pointer :: func
    func => x%a(i)
  end function func
end module m

use m
type(t) :: mt(3)
real :: res(3)
mt = t(1.0)
res = matmul(func(mt,1), reshape( (/1,2,3,4,5,6,7,8,9/), (/3,3 /) ))
if (res(1) /= 6.0 .and. res(2) /= 15.0 .and. res(3) /= 24.0) then
  print *, res
  stop 'error'
end if
end


-- 
           Summary: [4.3/4.4/4.5] ICE (segfault) at
                    gfc_trans_pointer_assignment for subpointer
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 42742
             nThis:


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

Reply via email to