public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97455] New: ICE on invalid code (wrong pointer assignment) in SELECT TYPE construct
@ 2020-10-16  8:16 federico.perini at gmail dot com
  2020-12-12 19:06 ` [Bug fortran/97455] " dominiq at lps dot ens.fr
  2021-03-31 17:28 ` gscfq@t-online.de
  0 siblings, 2 replies; 3+ messages in thread
From: federico.perini at gmail dot com @ 2020-10-16  8:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97455

            Bug ID: 97455
           Summary: ICE on invalid code (wrong pointer assignment) in
                    SELECT TYPE construct
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: federico.perini at gmail dot com
  Target Milestone: ---

Created attachment 49383
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49383&action=edit
Test program

Hi, 

the following code produces an ICE Segmentation fault with gfortran 9.2.0: 

module m
      implicit none

      type, public :: t
      end type t
      type, public, extends(t) :: tt
      end type tt
      type, public :: container
          class(t), allocatable :: x(:)
      end type container

      contains

      subroutine polymorphic(self)
         type(container), intent(in) :: self
         ! select type (x => self%x(:)) ! Correct code
         select type (x => x(:)) ! This wrong code produces an ICE
              type is (t)
                   print *, 'type(t)'
              type is (tt)
                   print *, 'type(tt)'
              class default
                   print *, 'other'
          end select
      end subroutine polymorphic
end module m

program test_ice
      use m
      implicit none
      type(container) :: c
      call polymorphic(c)
end program test_ice

Some similar bug (#86551) was already reported, but this deals with the pointer
associating to itself so I thought to open a new one instead.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-31 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16  8:16 [Bug fortran/97455] New: ICE on invalid code (wrong pointer assignment) in SELECT TYPE construct federico.perini at gmail dot com
2020-12-12 19:06 ` [Bug fortran/97455] " dominiq at lps dot ens.fr
2021-03-31 17:28 ` gscfq@t-online.de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).