User account creation filtered due to spam.

Bug 51293 - [OOP] ICE on ANY with overloaded == operator
Summary: [OOP] ICE on ANY with overloaded == operator
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-24 11:11 UTC by Jakub Jelinek
Modified: 2016-11-16 14:25 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2011-11-24 11:11:57 UTC
module stuff
   implicit none
   type a
      integer :: i, j
   end type a
   interface operator (==)
      module procedure equal_a
   end interface operator (==)
contains
   elemental function equal_a (x,y) result (same)
      class (a), intent(in) :: x, y
      logical :: same
      if ( x%i == y%i .and. x%j == y%j ) then
         same = .TRUE.
      else
         same = .FALSE.
      end if
   end function equal_a
end module stuff
program bugtest
   use stuff
   type (a), dimension(10) :: h
   type (a) :: g
   integer :: i
   if ( any(h == g) ) then
      write (*,*)
   end if
end program bugtest

ICEs on the trunk as well as 4.6 branch.
Comment 1 Tobias Burnus 2011-11-24 14:13:39 UTC
This usage requires support for polymorphic arrays - or at least the scalarizer needs to be able to handle this, which is part of the work Paul did.

Latest publicly available version of Paul's patch:
  http://gcc.gnu.org/ml/fortran/2011-11/msg00147.html

At least with the version I have, it works. The patch will be submitted in soon; there are still some small issues which should be fixed before it is submitted.
Comment 2 Tobias Burnus 2011-12-12 09:22:18 UTC
FIXED on the 4.7 trunk by the patch for PR 41539  (Rev. 182210).