SIGSEV in user-defined elemental function

Daniel Franke franke.daniel@gmail.com
Tue Nov 21 07:31:00 GMT 2006


Hi all,

could someone please comment on the validness of the code code, especially 
passing the null-pointer to the elemental function? As output, I would expect 
an empty line (as func should not be called?), instead, the application 
crahes with SIGSEV.

I am hunting this kind of application crashes for days now, please tell me I 
found the (or at least one of the) caus(es) ...

Thanks
	Daniel


$> cat sigsev.f90
PROGRAM main
  TYPE :: atype
    INTEGER, POINTER :: p => null()
  END TYPE

  TYPE(atype), DIMENSION(:), POINTER :: t
  t => null()
  WRITE(*,*) func(t)

  CONTAINS
    ELEMENTAL LOGICAL FUNCTION func(t)
      TYPE(atype), INTENT(in) :: t
      func = ASSOCIATED(t%p)
    END FUNCTION
END PROGRAM

$> gfortran-svn -g -Wall sigsev.f90 && ./a.out
Segmentation fault

$> gfortran-svn -v
gcc version 4.3.0 20061117 (experimental)
(the last one revision known to bootstrap before the loop-unrolling problem)



More information about the Fortran mailing list