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



             Bug #: 54851

           Summary: Compiling gfortran.dg/class_array_7.f03 with '-O1

                    -flto' gives an ICE

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

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

        ReportedBy: domi...@lps.ens.fr





Compiling gfortran.dg/class_array_7.f03 with '-O1 -flto' gives



In file included from :0:0:

/opt/gcc/_clean/gcc/testsuite/gfortran.dg/class_array_7.f03: In function

'main':

/opt/gcc/_clean/gcc/testsuite/gfortran.dg/class_array_7.f03:49:0: internal

compiler error: in fold_convert_loc, at fold-const.c:1979

   use realloc

 ^



Reduced test case



module realloc

  implicit none



  type :: base_type

     integer :: i

  end type base_type



contains



  character(20) function print_type (name, a)

    character(*), intent(in) :: name

    class(base_type), dimension(:), intent(in) :: a

    select type (a)

     type is (base_type);      print_type = NAME // " is base_type"

    end select

  end function



end module realloc



program main

  use realloc

  implicit none

  class(base_type), dimension(:), allocatable :: a



  allocate (base_type :: a(10))

  if (trim (print_type ("a", a)) .ne. "a is base_type") call abort

end program main

Reply via email to