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

* [Bug fortran/97455] ICE on invalid code (wrong pointer assignment) in SELECT TYPE construct
  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 ` dominiq at lps dot ens.fr
  2021-03-31 17:28 ` gscfq@t-online.de
  1 sibling, 0 replies; 3+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-12-12 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-12-12
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed since at least GCC7.
Note pr86551 is now fixed.

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

* [Bug fortran/97455] ICE on invalid code (wrong pointer assignment) in SELECT TYPE construct
  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
  1 sibling, 0 replies; 3+ messages in thread
From: gscfq@t-online.de @ 2021-03-31 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gscfq@t-online.de

--- Comment #2 from G. Steinmetz <gscfq@t-online.de> ---

Update, backtrace and a variation :


$ cat z1.f90
subroutine s
   select type (x => x(:))
   end select
end


$ cat z2.f90
subroutine s
   select type (x ==> x)
   end select
end


$ gfortran-11-20210328 -c z1.f90
f951: internal compiler error: Segmentation fault
0xc09d4f crash_signal
        ../../gcc/toplev.c:327
0x6576ba delete_root
        ../../gcc/fortran/bbt.c:150
0x65787e gfc_delete_bbt(void*, void*, int (*)(void*, void*))
        ../../gcc/fortran/bbt.c:197
0x7224d8 gfc_delete_symtree(gfc_symtree**, char const*)
        ../../gcc/fortran/symbol.c:2962
0x723bd6 gfc_restore_last_undo_checkpoint()
        ../../gcc/fortran/symbol.c:3706
0x6dab47 reject_statement
        ../../gcc/fortran/parse.c:2678
0x6de324 match_word
        ../../gcc/fortran/parse.c:70
0x6de324 decode_statement
        ../../gcc/fortran/parse.c:428
0x6dfb3c next_free
        ../../gcc/fortran/parse.c:1316
0x6dfb3c next_statement
        ../../gcc/fortran/parse.c:1548
0x6e1f04 parse_spec
        ../../gcc/fortran/parse.c:3783
0x6e3f7c parse_progunit
        ../../gcc/fortran/parse.c:5896
0x6e5a20 gfc_parse_file()
        ../../gcc/fortran/parse.c:6444
0x7320ef gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

^ 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).