This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ICE/Segmentation fault with user types, use only and modules


Hi,

I'm getting an ICE and segmentation fault in the following code. I think it may be related to Paul Thomas's observation about pointers to components of derived type arrays. However, it does compile under these circumstances:

* when foo and bar are not in the module
* when the module contains foo or bar but not both
* when the types a and b have no reference to each other
* when  ", only, a (or b)" is not used on the use statement

This used to work before about 20 August and works with the SUN compiler I use during my day job.

If this is deemed to be a new "feature" I can submit a PR.

      MODULE type_mod
         TYPE a
           INTEGER  :: n(10)
         END TYPE a
!
         TYPE b
           TYPE (a), POINTER :: m(:) => NULL ()
         END TYPE b
      END MODULE type_mod


MODULE seg_mod CONTAINS SUBROUTINE foo (x) USE type_mod, ONLY : a ! fails ! USE type_mod ! works IMPLICIT NONE TYPE (a) :: x ! RETURN END SUBROUTINE foo ! SUBROUTINE bar (x) USE type_mod, ONLY : b ! fails ! USE type_mod ! works IMPLICIT NONE TYPE (b) :: x ! RETURN END SUBROUTINE bar END MODULE seg_mod

gfc -c type_mod.f95 seg_mod.f95

seg_mod.f95:0: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

gfc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,fortran
             --prefix=/home/martin/GCC/usr/local --disable-nls
             --disable-multilib --enable-shared --enable-threads=posix
             --disable-checking --enable-long-long --enable-__cxa_atexit
             --enable-clocale=gnu --disable-libunwind-exception
Thread model: posix
gcc version 4.2.0 20060825 (experimental)

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]