ICE when using derived type with c_ptr component

Andrew Benson abenson@its.caltech.edu
Thu Aug 18 20:48:00 GMT 2011


The following seems to procude an ICE under gfortran v4.4.5:

module typeMod
  use, intrinsic :: iso_c_binding
  type, public :: myType
     private
     type(c_ptr) :: myPtr = c_null_ptr
  end type myType
end module typeMod

module testMod
contains
  double precision function myFunc1()
    use typeMod
    implicit none
    type(myType) :: myVar1
    
    return
  end function myFunc1
  double precision function myFunc2()
    use typeMod
    implicit none
    type(myType) :: myVar2
    return
  end function myFunc2  
end module testMod

$ gfortran -c test.F90
test.F90:12: internal compiler error: in gfc_conv_structure, at fortran/trans-
expr.c:3835
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

$ gfortran -c test.F90
test.F90:12: internal compiler error: in gfc_conv_structure, at fortran/trans-
expr.c:3835
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[abenson@AJB-Laptop-2009 v0.9.0_HOD]$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.4.5/configure --prefix=/usr/local/gcc4.4.5 --enable-
languages=c,c++,fortran --disable-multilib
Thread model: posix
gcc version 4.4.5 (GCC)

I couldn't find a anything which looks like this open in bugzilla.

The ICE goes away if I remove the " = c_null_ptr" or if I replace the two "use 
typeMod"s with a single one in the scope of "testMod". The code compiles 
correctly with gfortran 4.6.0 - I haven't tried it with any other versions.

-Andrew.

-- 

* Andrew Benson: http://www.tapir.caltech.edu/~abenson/contact.html

* Galacticus: http://sites.google.com/site/galacticusmodel



More information about the Fortran mailing list