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



             Bug #: 56081

           Summary: Seg fault ICE on select with bad case

    Classification: Unclassified

           Product: gcc

           Version: 4.7.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: rich...@lozestech.com





* Compiler version *

Using built-in specs.

COLLECT_GCC=gcc

COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.0/lto-wrapper.exe

Target: mingw32

Configured with: ../gcc-4.7.0/configure

--enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions

--with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry

--enable-libstdcxx-debug --disable-build-poststage1-with-cxx

--enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw

Thread model: win32

gcc version 4.7.0 (GCC) 



* Source code *

MODULE CompilerBug02

!!----

! PURPOSE:  Demonstrate compiler bug

! VERSION:  1.0, 21 January 2013

! AUTHOR:   Richard L Lozes, Lozes Technology Consulting

!!----



  USE, intrinsic :: iso_c_binding

  implicit none

  !save

  public



!!----

! PARAMETERS

!

      enum, bind(c)

        enumerator :: eGroup = 0, eGiraffe, eTiger, eElephant

      end enum



!!----

! VARIABLES

!

  integer(kind(eGroup)), dimension(:), allocatable :: animal_kind



!!----

! LOGIC

!

contains



  !!

  subroutine Pickle( lstatus )

    logical, intent(OUT)    :: lstatus

    integer   :: which





    allocate (animal_kind(4))



    do which=1,4

      animal_kind(which) = cGetAnAnimal( which )

      !select case(animal_kind(which))     !! gcc 4.7.0 compiler bug lives

here: ICE if '(which)' omitted !!

      select case(animal_kind)

      case (eGiraffe)

        lstatus = .true.

      case (eTiger)

        lstatus = .true.

      case (eElephant)

        lstatus = .true.

      case default

        lstatus = .false.

      end select

    enddo



  end subroutine Pickle



  !!

  function cGetAnAnimal( which ) result (i)

    integer, intent(IN) :: which

    integer     :: i



    i = 3



  end function cGetAnAnimal



END MODULE CompilerBug02



* Command line *

gfortran -Wall -fbounds-check -Wtabs -g -c ../Source/CompilerBug02.f03



* Message log *

 [warning elided]

../Source/CompilerBug02.f03: In function 'pickle':

../Source/CompilerBug02.f03:41:0: internal compiler error: Segmentation fault

Please submit a full bug report,

with preprocessed source if appropriate.

See <http://gcc.gnu.org/bugs.html> for instructions.

Reply via email to