The following code contains a generic interface which has two procedures, one
with an alternate return and one without.  This causes a segfault ICE.  If
either of the "module procedure" lines are commented out, however, the program
compiles.

Note, however, that adding an alternate return argument to the "with"
subroutine does not prevent the ICE.

I believe that this is valid code, as I have (unfortunately) not found any
prohibition in the standard against procedures with alternate returns in
generic interfaces.

-----------------------------------------------------------------------

debian-gfortran:~/test> cat arswitch.f90
module arswitch
  implicit none
  interface gen
    module procedure with
    module procedure without
  end interface
contains
  subroutine with(i,*)
    integer i
    if (i>0) then
      return 1
    else
      return
    end if
  end subroutine
  subroutine without()
    return
  end subroutine
end module

program test
  use arswitch
  implicit none
end
debian-gfortran:~/test> ../bin-trunk/bin/gfortran arswitch.f90 -o arswitch
arswitch.f90: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.

debian-gfortran:~/test> ../bin-trunk/bin/gfortran --version
GNU Fortran 95 (GCC) 4.3.0 20061128 (experimental)
Copyright (C) 2006 Free Software Foundation, Inc.


-- 
           Summary: alternate-return subroutine in generic interface causes
                    ice/segfault
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: brooks at gcc dot gnu dot org


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

Reply via email to