segmentation fault with gfortran

Kamaraju Kusumanchi kamaraju@gmail.com
Thu Oct 13 06:48:00 GMT 2005


Using Debian, sid

$uname -a
Linux kusumanchi 2.6.12-1-686-smp #1 SMP Tue Sep 27 13:10:31 JST 2005
i686 GNU/Linux

$gfortran -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit
--enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk
--enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre
--enable-mpfr --disable-werror --enable-checking=release
i486-linux-gnu
Thread model: posix
gcc version 4.0.2 (Debian 4.0.2-2)

$cat gfortran_bug.f90
module variables
  implicit none
  integer, parameter :: NX = 32
  real :: xco(0:NX)

contains
!------------------------------------------------------------------------------
function func1(N)
  implicit none
  real :: func1(0:N)
  integer, intent(in) :: N

  func1(:) = 1.0
end function func1
!------------------------------------------------------------------------------
function func2(N)
  implicit none
  real :: func2(0:N)
  integer, intent(in) :: N

  func2(:) = 1.0 + func1(N)
end function func2
end module variables


!------------------------------------------------------------------------------

program testsuite
  use variables
  xco = func2(NX)
end program testsuite



$gfortran gfortran_bug.f90

$./a.out
Segmentation fault



Is this a gfortran bug or is there any mistake in my code?
If it is a bug, can someone reduce this test case so that I can report
it? I could not reduce the test case any further.

thanks for any response
raju



More information about the Fortran mailing list