http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48800
Summary: [4.6/4.7 Regression] ICE with non-allocatable/pointer deferred-shape array Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: diagnostic, ice-on-invalid-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org Reported by Daniel Carrera at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/74905e43fe144fdd# The ICE - and thus the 4.6/4.7 regression - is due to -frealloc-lhs; with -fno-realloc-lhs, the program compiles with 4.4, 4.5, 4.6 and 4.7 without any diagnostic. It also compiles with pgf95 10.1-0. However, the program is invalid - and all my attempts to generate an ICE for a valid program failed. The invalidity is properly diagnosed by ifort 11.1, openf95 4.2.3 and pathf95 3.2.99. The program is invalid because in pure function dr(t, r_) real :: dr(:) "dr" is deferred-shaped but is neither allocatable nor a pointer. gfortran 4.6 and 4.7 fail with: test.f90: In function ‘runge_kutta_step’: test.f90:16:0: internal compiler error: in fold_binary_loc, at fold-const.c:9304 pure function runge_kutta_step(t, r_, dr, h) result(res) real, intent(in) :: t, r_(:), h real, dimension(:), allocatable :: k1, k2, k3, k4, res integer :: N interface pure function dr(t, r_) real, intent(in) :: t, r_(:) real :: dr(4) end function end interface N = size(r_) allocate(k1(N),k2(N),k3(N),k4(N),res(N)) k1 = dr(t, r_) k2 = dr(t + h/2, r_ + k1*h/2) k3 = dr(t + h/2, r_ + k2*h/2) k4 = dr(t + h , r_ + k3*h) res = r_ + (k1 + 2*k2 + 2*k3 + k4) * h/6 end function