[Bug fortran/29321] New: optional arguments+derived types = segmentation fault

gcc-bugzilla at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Oct 2 12:53:00 GMT 2006



Compilation of functions/subroutines with optional derived type arguments 
gives segmentation fault. 

a.F90: In function 'func':
a.F90:11: 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.

If I remove one of the optional arguments (C in SUB)
in the sample code below it appears to work

Environment:
System: Linux olavs 2.6.8-2-686 #1 Thu May 19 17:53:30 JST 2005 i686 GNU/Linux
Architecture: i686


host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../gcc/configure
--prefix=/cosmic/coudert/tmp/gfortran-20060906/irun
--enable-languages=c,fortran --host=i386-linux
--with-gmp=/cosmic/coudert/tmp/gfortran-20060906/gfortran_libs

How-To-Repeat:

MODULE MYINT
   TYPE NUM
      INTEGER :: R = 0
   END TYPE NUM
   CONTAINS 
      FUNCTION FUNC(A,B) RESULT(E)
      IMPLICIT NONE
      TYPE(NUM)  A,B,E
      INTENT(IN) ::  A,B
      OPTIONAL B
      E%R=A%R
      CALL SUB(A,E)
      END FUNCTION FUNC

      SUBROUTINE SUB(A,E,B,C)
      IMPLICIT NONE
      TYPE(NUM) A,E,B,C
      INTENT(IN)   A,B
      INTENT(OUT)  E,C
      OPTIONAL B,C
      E%R=A%R
      END SUBROUTINE SUB
END MODULE MYINT


-- 
           Summary: optional arguments+derived types = segmentation fault
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vahtras at pdc dot kth dot se
 GCC build triplet: i386-pc-linux-gnu
  GCC host triplet: i386-pc-linux-gnu
GCC target triplet: i386-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29321



More information about the Gcc-bugs mailing list