public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297
@ 2021-12-07 19:39 gscfq@t-online.de
  2021-12-07 19:40 ` [Bug fortran/103606] " gscfq@t-online.de
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gscfq@t-online.de @ 2021-12-07 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103606
           Summary: [9/10/11/12 Regression] ICE in resolve_fl_procedure,
                    at fortran/resolve.c:13297
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

With a missing attribute allocatable or pointer, started with r7 :
(gcc configured with --enable-checking=yes)


$ cat z1.f90
program p
   type t
   end type
contains
   elemental function f() result(z)
      class(t) :: z
   end
end


$ gfortran-12-20211205 -c z1.f90
z1.f90:5:35:

    5 |    elemental function f() result(z)
      |                                   1
Error: CLASS variable 'z' at (1) must be dummy, allocatable or pointer
f951: internal compiler error: Segmentation fault
0xf0b99f crash_signal
        ../../gcc/toplev.c:322
0x859de6 resolve_fl_procedure
        ../../gcc/fortran/resolve.c:13297
0x859de6 resolve_symbol
        ../../gcc/fortran/resolve.c:16110
0x876b52 do_traverse_symtree
        ../../gcc/fortran/symbol.c:4174
0x85af84 resolve_types
        ../../gcc/fortran/resolve.c:17449
0x85642c gfc_resolve(gfc_namespace*)
        ../../gcc/fortran/resolve.c:17564
0x83e764 resolve_all_program_units
        ../../gcc/fortran/parse.c:6586
0x83e764 gfc_parse_file()
        ../../gcc/fortran/parse.c:6842
0x88c73f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
@ 2021-12-07 19:40 ` gscfq@t-online.de
  2021-12-08  7:51 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: gscfq@t-online.de @ 2021-12-07 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

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

Adding this attribute yields a still invalid but non-ICE-ing code :


$ cat z2.f90
program p
   type t
   end type
contains
   elemental function f() result(z)
      class(t), allocatable :: z
   end
end


$ gfortran-12-20211205 -c z2.f90
z2.f90:5:35:

    5 |    elemental function f() result(z)
      |                                   1
Error: Function result variable 'z' at (1) of elemental function 'f' shall not
have an ALLOCATABLE or POINTER attribute

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
  2021-12-07 19:40 ` [Bug fortran/103606] " gscfq@t-online.de
@ 2021-12-08  7:51 ` pinskia at gcc dot gnu.org
  2021-12-08  9:03 ` [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345 marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-08  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
  2021-12-07 19:40 ` [Bug fortran/103606] " gscfq@t-online.de
  2021-12-08  7:51 ` pinskia at gcc dot gnu.org
@ 2021-12-08  9:03 ` marxin at gcc dot gnu.org
  2021-12-10 21:16 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-08  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression] ICE |[9/10/11/12 Regression] ICE
                   |in resolve_fl_procedure, at |in resolve_fl_procedure, at
                   |fortran/resolve.c:13297     |fortran/resolve.c:13297
                   |                            |since
                   |                            |r9-3324-g2b03b800d866d345
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org
   Last reconfirmed|                            |2021-12-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r9-3324-g2b03b800d866d345.

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-12-08  9:03 ` [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345 marxin at gcc dot gnu.org
@ 2021-12-10 21:16 ` anlauf at gcc dot gnu.org
  2021-12-10 21:50 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-10 21:16 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Tentative semi-obvious patch:

diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 0ed31970f8b..bff1b35446f 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -13294,7 +13294,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)

   /* An elemental function is required to return a scalar 12.7.1  */
   if (sym->attr.elemental && sym->attr.function
-      && (sym->as || (sym->ts.type == BT_CLASS && CLASS_DATA (sym)->as)))
+      && (sym->as || (sym->ts.type == BT_CLASS && sym->attr.class_ok
+                     && CLASS_DATA (sym)->as)))
     {
       gfc_error ("ELEMENTAL function %qs at %L must have a scalar "
                 "result", sym->name, &sym->declared_at);

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-12-10 21:16 ` anlauf at gcc dot gnu.org
@ 2021-12-10 21:50 ` anlauf at gcc dot gnu.org
  2021-12-11 21:00 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-10 21:50 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-December/057155.html

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-12-10 21:50 ` anlauf at gcc dot gnu.org
@ 2021-12-11 21:00 ` cvs-commit at gcc dot gnu.org
  2021-12-12 20:31 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-11 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:7e913caad081ea85da4f257265f2d3383cdbe8d5

commit r12-5911-g7e913caad081ea85da4f257265f2d3383cdbe8d5
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Dec 10 22:41:24 2021 +0100

    Fortran: fix checking of elemental functions of type CLASS

    gcc/fortran/ChangeLog:

            PR fortran/103606
            * resolve.c (resolve_fl_procedure): Do not access CLASS components
            before class container has been built.

    gcc/testsuite/ChangeLog:

            PR fortran/103606
            * gfortran.dg/pr103606.f90: New test.

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-12-11 21:00 ` cvs-commit at gcc dot gnu.org
@ 2021-12-12 20:31 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-12 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:ce80f2c0e7a86e555201e9e61a26306adff4a074

commit r11-9378-gce80f2c0e7a86e555201e9e61a26306adff4a074
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Dec 10 22:41:24 2021 +0100

    Fortran: fix checking of elemental functions of type CLASS

    gcc/fortran/ChangeLog:

            PR fortran/103606
            * resolve.c (resolve_fl_procedure): Do not access CLASS components
            before class container has been built.

    gcc/testsuite/ChangeLog:

            PR fortran/103606
            * gfortran.dg/pr103606.f90: New test.

    (cherry picked from commit 7e913caad081ea85da4f257265f2d3383cdbe8d5)

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-12-12 20:31 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:38 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:40 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-16 22:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:b0b1b21c561a0fe5f334a16662cd27f923842bf6

commit r10-10344-gb0b1b21c561a0fe5f334a16662cd27f923842bf6
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Dec 10 22:41:24 2021 +0100

    Fortran: fix checking of elemental functions of type CLASS

    gcc/fortran/ChangeLog:

            PR fortran/103606
            * resolve.c (resolve_fl_procedure): Do not access CLASS components
            before class container has been built.

    gcc/testsuite/ChangeLog:

            PR fortran/103606
            * gfortran.dg/pr103606.f90: New test.

    (cherry picked from commit 7e913caad081ea85da4f257265f2d3383cdbe8d5)

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:38 ` cvs-commit at gcc dot gnu.org
  2021-12-16 22:40 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-16 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:12d811d06f2ea178ac9b40c5399ba41eb5f374df

commit r9-9873-g12d811d06f2ea178ac9b40c5399ba41eb5f374df
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Dec 10 22:41:24 2021 +0100

    Fortran: fix checking of elemental functions of type CLASS

    gcc/fortran/ChangeLog:

            PR fortran/103606
            * resolve.c (resolve_fl_procedure): Do not access CLASS components
            before class container has been built.

    gcc/testsuite/ChangeLog:

            PR fortran/103606
            * gfortran.dg/pr103606.f90: New test.

    (cherry picked from commit 7e913caad081ea85da4f257265f2d3383cdbe8d5)

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

* [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345
  2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2021-12-16 22:38 ` cvs-commit at gcc dot gnu.org
@ 2021-12-16 22:40 ` anlauf at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-16 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

Thanks for the report!

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

end of thread, other threads:[~2021-12-16 22:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 19:39 [Bug fortran/103606] New: [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 gscfq@t-online.de
2021-12-07 19:40 ` [Bug fortran/103606] " gscfq@t-online.de
2021-12-08  7:51 ` pinskia at gcc dot gnu.org
2021-12-08  9:03 ` [Bug fortran/103606] [9/10/11/12 Regression] ICE in resolve_fl_procedure, at fortran/resolve.c:13297 since r9-3324-g2b03b800d866d345 marxin at gcc dot gnu.org
2021-12-10 21:16 ` anlauf at gcc dot gnu.org
2021-12-10 21:50 ` anlauf at gcc dot gnu.org
2021-12-11 21:00 ` cvs-commit at gcc dot gnu.org
2021-12-12 20:31 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:22 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:38 ` cvs-commit at gcc dot gnu.org
2021-12-16 22:40 ` 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).