public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107681] New: [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018
@ 2022-11-14 17:28 gscfq@t-online.de
  2022-11-14 20:15 ` [Bug fortran/107681] " anlauf at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gscfq@t-online.de @ 2022-11-14 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107681
           Summary: [13 Regression] ICE in gfc_type_is_extensible, at
                    fortran/resolve.cc:9018
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20220717 and 20220724 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
program p
   type t
      integer, allocatable :: a
   end type
   class(t) :: x[*]
   associate (y => x)
   end associate
end


$ cat z2.f90
program p
   type t
      integer, allocatable :: a
   end type
   class(t) :: x[:]
   associate (y => x)
   end associate
end


$ gfortran-12 -c z1.f90 -fcoarray=lib
z1.f90:5:19:

    5 |    class(t) :: x[*]
      |                   1
Error: CLASS variable 'x' at (1) must be dummy, allocatable or pointer


$ gfortran-13-20221106 -c z1.f90 -fcoarray=lib
z1.f90:5:19:

    5 |    class(t) :: x[*]
      |                   1
Error: CLASS variable 'x' at (1) must be dummy, allocatable or pointer
z1.f90:6:20:

    6 |    associate (y => x)
      |                    1
Error: Invalid array reference of a non-array entity at (1)
f951: internal compiler error: Segmentation fault
0xf4697f crash_signal
        ../../gcc/toplev.cc:314
0x6b337f gfc_type_is_extensible(gfc_symbol*)
        ../../gcc/fortran/resolve.cc:9018
0x6b337f resolve_fl_var_and_proc
        ../../gcc/fortran/resolve.cc:12970
0x87c32d resolve_fl_variable
        ../../gcc/fortran/resolve.cc:13089
0x87c32d resolve_symbol
        ../../gcc/fortran/resolve.cc:16183
0x89ad62 do_traverse_symtree
        ../../gcc/fortran/symbol.cc:4180
0x87efd4 resolve_types
        ../../gcc/fortran/resolve.cc:17542
0x87a43c gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17657
0x87840c gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17644
0x87840c resolve_block_construct
        ../../gcc/fortran/resolve.cc:10825
0x87840c gfc_resolve_code(gfc_code*, gfc_namespace*)
        ../../gcc/fortran/resolve.cc:12258
0x87a387 resolve_codes
        ../../gcc/fortran/resolve.cc:17624
0x87a44e gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.cc:17659
0x862214 resolve_all_program_units
        ../../gcc/fortran/parse.cc:6631
0x862214 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6887
0x8b0c8f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/107681] [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018
  2022-11-14 17:28 [Bug fortran/107681] New: [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018 gscfq@t-online.de
@ 2022-11-14 20:15 ` anlauf at gcc dot gnu.org
  2022-11-16 20:45 ` cvs-commit at gcc dot gnu.org
  2022-11-16 20:51 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-14 20:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
     Ever confirmed|0                           |1
                 CC|                            |anlauf at gcc dot gnu.org
   Last reconfirmed|                            |2022-11-14
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

NULL pointer dereference, e.g. fixed by:

diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 5ff1cd070ac..24e5aa03556 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -12967,6 +12967,7 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
          && sym->ts.u.derived
          && !sym->attr.select_type_temporary
          && !UNLIMITED_POLY (sym)
+         && CLASS_DATA (sym)->ts.u.derived
          && !gfc_type_is_extensible (CLASS_DATA (sym)->ts.u.derived))
        {
          gfc_error ("Type %qs of CLASS variable %qs at %L is not extensible",

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

* [Bug fortran/107681] [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018
  2022-11-14 17:28 [Bug fortran/107681] New: [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018 gscfq@t-online.de
  2022-11-14 20:15 ` [Bug fortran/107681] " anlauf at gcc dot gnu.org
@ 2022-11-16 20:45 ` cvs-commit at gcc dot gnu.org
  2022-11-16 20:51 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-16 20:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:96e4244ef3ccf4867ca4e37fbc6800e64ef30af6

commit r13-4107-g96e4244ef3ccf4867ca4e37fbc6800e64ef30af6
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Nov 16 21:41:19 2022 +0100

    Fortran: error recovery after reference to bad CLASS variable [PR107681]

    gcc/fortran/ChangeLog:

            PR fortran/107681
            * resolve.cc (resolve_fl_var_and_proc): Prevent NULL pointer
            dereference with reference to bad CLASS variable.

    gcc/testsuite/ChangeLog:

            PR fortran/107681
            * gfortran.dg/pr107681.f90: New test.

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

* [Bug fortran/107681] [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018
  2022-11-14 17:28 [Bug fortran/107681] New: [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018 gscfq@t-online.de
  2022-11-14 20:15 ` [Bug fortran/107681] " anlauf at gcc dot gnu.org
  2022-11-16 20:45 ` cvs-commit at gcc dot gnu.org
@ 2022-11-16 20:51 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-16 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from anlauf at gcc dot gnu.org ---
Fixed.

Thanks for the report!

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

end of thread, other threads:[~2022-11-16 20:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 17:28 [Bug fortran/107681] New: [13 Regression] ICE in gfc_type_is_extensible, at fortran/resolve.cc:9018 gscfq@t-online.de
2022-11-14 20:15 ` [Bug fortran/107681] " anlauf at gcc dot gnu.org
2022-11-16 20:45 ` cvs-commit at gcc dot gnu.org
2022-11-16 20:51 ` anlauf at gcc dot gnu.org

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