http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49328
Summary: Internal compiler error due to explicit array bounds
in contained routine argument
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Consider the following program:
!-----------------------
module test_mod
contains
subroutine twiss3_at_start ()
implicit none
type t_struct
real beta, alpha, gamma, phi
end type
type (t_struct) b
real g(6,6), tune3
call mode1_calc (g(3:4, 3:4), tune3, b)
contains
subroutine mode1_calc (gg, tune, twiss)
type (t_struct) twiss
real gg(2,2), tune
twiss%beta = gg(2,2)**2
end subroutine
end subroutine
end module
!-----------------------
compiling gives:
lnx4103:~/dcs/bmad_distribution/bmad_dist/test> gfortran --version
GNU Fortran (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.
lnx4103:~/dcs/bmad_distribution/bmad_dist/test> gfortran -c -O2 test.f90
test.f90: In function 'twiss3_at_start':
test.f90:14:0: internal compiler error: in build2_stat, at tree.c:3681
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Removing the "-O2" compile option fixes things. Also changing "real gg(2,2)" to
"real gg(:,:)" also fixes things.