public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
@ 2020-06-16 18:54 gscfq@t-online.de
  2020-06-17 13:10 ` [Bug fortran/95710] " dominiq at lps dot ens.fr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2020-06-16 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95710
           Summary: ICE in gfc_type_is_extensible, at
                    fortran/resolve.c:8848
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to r6, with a doubled declaration :


$ cat z1.f90
module m
   type t
      integer :: a = 1
   end type
   interface
      module subroutine s
      end
   end interface
end
submodule(m) m2
contains
   subroutine s   ! or module subroutine s
      class(t), allocatable :: x
      class(t), allocatable :: x
   end
end


$ cat z2.f90
module m
   type t
      integer :: a = 1
   end type
   interface
      module subroutine s
      end
   end interface
end
submodule(m) m2
contains
   subroutine s   ! or module procedure s
      class(t), pointer :: x
      class(t), pointer :: x
   end
end


$ cat z3.f90
module m
   type t
      integer :: a = 1
   end type
   interface
      module subroutine s
      end
   end interface
end
submodule(m) m2
contains
   subroutine s
      class(t), allocatable :: x
      class(t), pointer :: x
   end
end


$ gfortran-11-20200614 -c z1.f90
f951: internal compiler error: Segmentation fault
0xbcdd2f crash_signal
        ../../gcc/toplev.c:328
0x5e5861 gfc_type_is_extensible(gfc_symbol*)
        ../../gcc/fortran/resolve.c:8848
0x5e5861 resolve_fl_var_and_proc
        ../../gcc/fortran/resolve.c:12658
0x6ce441 resolve_fl_variable
        ../../gcc/fortran/resolve.c:12774
0x6ce441 resolve_symbol
        ../../gcc/fortran/resolve.c:15835
0x6eb7d2 do_traverse_symtree
        ../../gcc/fortran/symbol.c:4162
0x6d0a84 resolve_types
        ../../gcc/fortran/resolve.c:17175
0x6d0b90 resolve_types
        ../../gcc/fortran/resolve.c:17186
0x6cc19c gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17290
0x6b40f2 gfc_parse_file()
        ../../gcc/fortran/parse.c:6447
0x70036f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/95710] ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
  2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
@ 2020-06-17 13:10 ` dominiq at lps dot ens.fr
  2020-06-17 21:13 ` kargl at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-06-17 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-06-17
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed. No submodule in r5.

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

* [Bug fortran/95710] ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
  2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
  2020-06-17 13:10 ` [Bug fortran/95710] " dominiq at lps dot ens.fr
@ 2020-06-17 21:13 ` kargl at gcc dot gnu.org
  2021-11-10 17:58 ` gscfq@t-online.de
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-06-17 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #2 from kargl at gcc dot gnu.org ---
Tested against z1.f90.  Untested otherwise.  I don't use CLASSes.

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 280157)
+++ gcc/fortran/resolve.c       (working copy)
@@ -8798,6 +8798,9 @@ resolve_select (gfc_code *code, bool select_type)
 bool
 gfc_type_is_extensible (gfc_symbol *sym)
 {
+  if (!sym)
+    return false;
+
   return !(sym->attr.is_bind_c || sym->attr.sequence
           || (sym->attr.is_class
               && sym->components->ts.u.derived->attr.unlimited_polymorphic));
@@ -12595,9 +12599,13 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
          && !UNLIMITED_POLY (sym)
          && !gfc_type_is_extensible (CLASS_DATA (sym)->ts.u.derived))
        {
-         gfc_error ("Type %qs of CLASS variable %qs at %L is not extensible",
-                    CLASS_DATA (sym)->ts.u.derived->name, sym->name,
-                    &sym->declared_at);
+         if (CLASS_DATA (sym)->ts.u.derived)
+           gfc_error ("Type %qs of CLASS variable %qs at %L is not
extensible",
+                        CLASS_DATA (sym)->ts.u.derived->name,
+                       sym->name, &sym->declared_at);
+         else
+           gfc_error ("CLASS variable %qs at %L is not extensible",
+                       sym->name, &sym->declared_at);
          return false;
        }

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

* [Bug fortran/95710] ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
  2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
  2020-06-17 13:10 ` [Bug fortran/95710] " dominiq at lps dot ens.fr
  2020-06-17 21:13 ` kargl at gcc dot gnu.org
@ 2021-11-10 17:58 ` gscfq@t-online.de
  2023-09-22 19:17 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2021-11-10 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

A few more related test files :


$ cat zz1.f90
module m
   interface
      module subroutine s
      end
   end interface
end
submodule(m) m2
contains
   subroutine s
      class(*), allocatable :: x
      class(*), allocatable :: x
   end
end


$ cat zz2.f90
module m
   interface
      module function s()
      end
   end interface
end
submodule(m) m2
contains
   function s()
      class(*), allocatable :: x
      class(*), allocatable :: x
   end
end


$ cat zz3.f90
program p
   interface
      module function s()
         class(*), allocatable :: s
         class(*), allocatable :: s
      end
   end interface
end


$ gfortran-12-20211107 -c zz3.f90
f951: internal compiler error: Segmentation fault
0xd4f7bf crash_signal
        ../../gcc/toplev.c:322
0x811d2e resolve_symbol
        ../../gcc/fortran/resolve.c:15582
0x830df2 do_traverse_symtree
        ../../gcc/fortran/symbol.c:4172
0x815254 resolve_types
        ../../gcc/fortran/resolve.c:17453
0x81081c gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17568
0x7f8ae4 resolve_all_program_units
        ../../gcc/fortran/parse.c:6564
0x7f8ae4 gfc_parse_file()
        ../../gcc/fortran/parse.c:6820
0x845d3f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/95710] ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
  2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-10 17:58 ` gscfq@t-online.de
@ 2023-09-22 19:17 ` anlauf at gcc dot gnu.org
  2023-09-23 17:21 ` cvs-commit at gcc dot gnu.org
  2023-09-23 18:15 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-22 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |anlauf at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #4 from anlauf at gcc dot gnu.org ---
Patch here: https://gcc.gnu.org/pipermail/fortran/2023-September/059769.html

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

* [Bug fortran/95710] ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
  2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-09-22 19:17 ` anlauf at gcc dot gnu.org
@ 2023-09-23 17:21 ` cvs-commit at gcc dot gnu.org
  2023-09-23 18:15 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-23 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:767eea9ea22f0247be9a56fd2e1d460ddfbbf6d9

commit r14-4238-g767eea9ea22f0247be9a56fd2e1d460ddfbbf6d9
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Sep 22 21:06:00 2023 +0200

    fortran: error recovery on duplicate declaration of class variable
[PR95710]

    gcc/fortran/ChangeLog:

            PR fortran/95710
            * class.cc (gfc_build_class_symbol): Do not try to build class
            container for invalid typespec.
            * resolve.cc (resolve_fl_var_and_proc): Prevent NULL pointer
            dereference.
            (resolve_symbol): Likewise.

    gcc/testsuite/ChangeLog:

            PR fortran/95710
            * gfortran.dg/pr95710.f90: New test.

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

* [Bug fortran/95710] ICE in gfc_type_is_extensible, at fortran/resolve.c:8848
  2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-09-23 17:21 ` cvs-commit at gcc dot gnu.org
@ 2023-09-23 18:15 ` anlauf at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-23 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #6 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-14.

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

end of thread, other threads:[~2023-09-23 18:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 18:54 [Bug fortran/95710] New: ICE in gfc_type_is_extensible, at fortran/resolve.c:8848 gscfq@t-online.de
2020-06-17 13:10 ` [Bug fortran/95710] " dominiq at lps dot ens.fr
2020-06-17 21:13 ` kargl at gcc dot gnu.org
2021-11-10 17:58 ` gscfq@t-online.de
2023-09-22 19:17 ` anlauf at gcc dot gnu.org
2023-09-23 17:21 ` cvs-commit at gcc dot gnu.org
2023-09-23 18:15 ` 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).