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

             Bug #: 52016
           Summary: [OOP] Polymorphism and elemental: missing diagnostic
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: [email protected]
        ReportedBy: [email protected]


This PR is probably a duplicate of pr52013 with a fix before submission (see
http://gcc.gnu.org/ml/fortran/2012-01/msg00224.html ;-).

While investigating why the test in pr50981 comment #23 was yielding an ICE
even with the patch from http://gcc.gnu.org/ml/fortran/2012-01/msg00223.html ,
I reduced the origin of the ICE to the following test

    type t
      integer :: a
    end type t
  type(t), allocatable :: var1, var2(:)
  allocate(var1, var2(2))
  call sub_ctae(var2)
 if (any (var2%a /= 9)) call abort()

contains
  elemental subroutine sub_ctae(y)
    class(t), intent(inout), optional :: y(:) ! <-- invalid and gives an ICE
!    class(t), intent(inout), optional :: y ! <-- valid and works
    if (present(y)) y%a = 9
    if (present(y)) i = 7
  end subroutine sub_ctae
end

which gives

pr50981_4_red.f90: In function 'sub_ctae':
pr50981_4_red.f90:13:0: internal compiler error: in
gfc_conv_descriptor_data_get, at fortran/trans-array.c:147

for an unpatched r183306 and

pr50981_4_red.f90: In function 'MAIN__':
pr50981_4_red.f90:6:0: internal compiler error: in fold_convert_loc, at
fold-const.c:2016

for my patched tree.

Reply via email to