This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/16861] segfault with doubly used module
- From: "dmitrym at acres dot com dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Nov 2004 05:35:52 -0000
- Subject: [Bug fortran/16861] segfault with doubly used module
- References: <20040803172636.16861.yosef@phys.utb.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dmitrym at acres dot com dot au 2004-11-09 05:35 -------
The bug 17764 was incorrectly linked to this (see comments in that entry).
I simplified the 20k source file above to ~600 bytes. Compilation attempt (using
gfortran as of Nov 09, 2004) still gives "Internal compiler error. Segmentation
fault." Now, the simplified code is:
--- snip ---
module NullGrid_Vars
implicit none
! INTEGER*4, parameter :: lsh = 10
INTEGER*4, save :: lsh
end module NullGrid_Vars
!
module NullInterp_InterpUtil
implicit none
contains
subroutine NullInterp_Util_cinterp(J1)
use NullGrid_Vars
implicit none
!input variables
COMPLEX*16, dimension(lsh), intent(inout) :: J1
end subroutine NullInterp_Util_cinterp
end module NullInterp_InterpUtil
!
module NullInterp_Interp
implicit none
contains
subroutine NullInterp_cinterp()
use NullGrid_Vars
use NullInterp_InterpUtil
implicit none
end subroutine NullInterp_cinterp
end module NullInterp_Interp
--- snip ---
As you may see, the second module (NullInterp_InterpUtil) gives the dimension of
its in/out array as the variable lsh from the first module (NullGrid_Vars).
However, lsh is a variable (although SAVEd). I'm not a standard guru, but it
seems to me that such behavior is wrong, as the array size cannot be known at
compilation time. If lsh is made a parameter (uncomment the line, comment the
save line), then the code compiles without a hitch.
Summary: I believe this is a bug in Fortran source file submitted as a test
case, and not a gfortran bug.
The 17764 was a genuine gfortran bug, and it was corrected during the last
couple days (I checked couple times a week, so cannot pinpoint the exact moment).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16861