public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446
@ 2020-06-03 15:44 gscfq@t-online.de
  2020-06-03 16:52 ` [Bug fortran/95502] " kargl at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2020-06-03 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95502
           Summary: ICE in gfc_check_do_variable, at fortran/parse.c:4446
           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: ---

Changed between 20181028 (error) and 20181104 (ICE) :


$ cat z1.f90
program p
   integer, pointer :: z
   nullify(z%kind)
end


$ cat z2.f90
program p
   complex, pointer :: z
   nullify(z%kind)
   ! nullify(z%re)
   ! nullify(z%im)
end


$ cat z3.f90
program p
   character, pointer :: z
   nullify(z%len)
   nullify(z%kind)
end


$ gfortran-11-20200531 -c z1.f90
f951: internal compiler error: Segmentation fault
0xbc37bf crash_signal
        ../../gcc/toplev.c:328
0x6aeed8 gfc_check_do_variable(gfc_symtree*)
        ../../gcc/fortran/parse.c:4446
0x6895ab gfc_match_nullify()
        ../../gcc/fortran/match.c:4625
0x6a7651 match_word
        ../../gcc/fortran/parse.c:65
0x6ab35d decode_statement
        ../../gcc/fortran/parse.c:527
0x6ac41a next_free
        ../../gcc/fortran/parse.c:1279
0x6ac41a next_statement
        ../../gcc/fortran/parse.c:1511
0x6ada6b parse_spec
        ../../gcc/fortran/parse.c:3922
0x6b083c parse_progunit
        ../../gcc/fortran/parse.c:5851
0x6b1f19 gfc_parse_file()
        ../../gcc/fortran/parse.c:6392
0x6fdfff gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:210

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
@ 2020-06-03 16:52 ` kargl at gcc dot gnu.org
  2020-06-09 11:40 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-06-03 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2020-06-03
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from kargl at gcc dot gnu.org ---
Fixes z1.f90.  May fix others.

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 280157)
+++ gcc/fortran/parse.c (working copy)
@@ -4440,6 +4440,9 @@ gfc_check_do_variable (gfc_symtree *st)
 {
   gfc_state_data *s;

+  if (!st)
+    return 0;
+
   for (s=gfc_state_stack; s; s = s->previous)
     if (s->do_variable == st)
       {
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (revision 280157)
+++ gcc/fortran/expr.c  (working copy)
@@ -3784,6 +3784,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *
   int proc_pointer;
   bool same_rank;

+  if (!lvalue->symtree)
+    return false;
+
   lhs_attr = gfc_expr_attr (lvalue);
   if (lvalue->ts.type == BT_UNKNOWN && !lhs_attr.proc_pointer)
     {

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
  2020-06-03 16:52 ` [Bug fortran/95502] " kargl at gcc dot gnu.org
@ 2020-06-09 11:40 ` marxin at gcc dot gnu.org
  2021-06-04 21:13 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-06-09 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started to ICE with r9-3803-ga5fbc2f36a291cbe.

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
  2020-06-03 16:52 ` [Bug fortran/95502] " kargl at gcc dot gnu.org
  2020-06-09 11:40 ` marxin at gcc dot gnu.org
@ 2021-06-04 21:13 ` anlauf at gcc dot gnu.org
  2021-06-16 19:54 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-06-04 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #3 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-June/056133.html

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-06-04 21:13 ` anlauf at gcc dot gnu.org
@ 2021-06-16 19:54 ` cvs-commit at gcc dot gnu.org
  2021-06-16 20:05 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-16 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:72e3d92178b44a3722519ec68e72e307443bda70

commit r12-1540-g72e3d92178b44a3722519ec68e72e307443bda70
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Jun 16 21:54:16 2021 +0200

    Fortran - ICE in gfc_check_do_variable, at fortran/parse.c:4446

    Avoid NULL pointer dereferences during error recovery.

    gcc/fortran/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * expr.c (gfc_check_pointer_assign): Avoid NULL pointer
            dereference.
            * match.c (gfc_match_pointer_assignment): Likewise.
            * parse.c (gfc_check_do_variable): Avoid comparison with NULL
            symtree.

    gcc/testsuite/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * gfortran.dg/pr95502.f90: New test.

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-06-16 19:54 ` cvs-commit at gcc dot gnu.org
@ 2021-06-16 20:05 ` cvs-commit at gcc dot gnu.org
  2021-06-18 18:21 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-16 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r12-1542-gcfe0a2ec26867b290eb84af00317e60f8b67455c
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Jun 16 22:04:22 2021 +0200

    Fortran - ICE in gfc_check_do_variable, at fortran/parse.c:4446

    Avoid NULL pointer dereferences during error recovery.

    gcc/fortran/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * expr.c (gfc_check_pointer_assign): Avoid NULL pointer
            dereference.
            * match.c (gfc_match_pointer_assignment): Likewise.
            * parse.c (gfc_check_do_variable): Avoid comparison with NULL
            symtree.

    gcc/testsuite/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * gfortran.dg/pr95502.f90: New test.

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-06-16 20:05 ` cvs-commit at gcc dot gnu.org
@ 2021-06-18 18:21 ` cvs-commit at gcc dot gnu.org
  2021-06-18 18:42 ` cvs-commit at gcc dot gnu.org
  2021-06-18 18:45 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-18 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:067e45a6f376582b1d3d36cc9b2124b60093b5c2

commit r11-8622-g067e45a6f376582b1d3d36cc9b2124b60093b5c2
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Jun 16 22:04:22 2021 +0200

    Fortran - ICE in gfc_check_do_variable, at fortran/parse.c:4446

    Avoid NULL pointer dereferences during error recovery.

    gcc/fortran/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * expr.c (gfc_check_pointer_assign): Avoid NULL pointer
            dereference.
            * match.c (gfc_match_pointer_assignment): Likewise.
            * parse.c (gfc_check_do_variable): Avoid comparison with NULL
            symtree.

    gcc/testsuite/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * gfortran.dg/pr95502.f90: New test.

    (cherry picked from commit cfe0a2ec26867b290eb84af00317e60f8b67455c)

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-06-18 18:21 ` cvs-commit at gcc dot gnu.org
@ 2021-06-18 18:42 ` cvs-commit at gcc dot gnu.org
  2021-06-18 18:45 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-18 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:0c084361a5a800ee0920bf29b6673816d2b35e76

commit r10-9946-g0c084361a5a800ee0920bf29b6673816d2b35e76
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Jun 16 22:04:22 2021 +0200

    Fortran - ICE in gfc_check_do_variable, at fortran/parse.c:4446

    Avoid NULL pointer dereferences during error recovery.

    gcc/fortran/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * expr.c (gfc_check_pointer_assign): Avoid NULL pointer
            dereference.
            * match.c (gfc_match_pointer_assignment): Likewise.
            * parse.c (gfc_check_do_variable): Avoid comparison with NULL
            symtree.

    gcc/testsuite/ChangeLog:

            PR fortran/95501
            PR fortran/95502
            * gfortran.dg/pr95502.f90: New test.

    (cherry picked from commit cfe0a2ec26867b290eb84af00317e60f8b67455c)

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

* [Bug fortran/95502] ICE in gfc_check_do_variable, at fortran/parse.c:4446
  2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-06-18 18:42 ` cvs-commit at gcc dot gnu.org
@ 2021-06-18 18:45 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-06-18 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-12, and backported to 11- and 10-branch.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2021-06-18 18:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 15:44 [Bug fortran/95502] New: ICE in gfc_check_do_variable, at fortran/parse.c:4446 gscfq@t-online.de
2020-06-03 16:52 ` [Bug fortran/95502] " kargl at gcc dot gnu.org
2020-06-09 11:40 ` marxin at gcc dot gnu.org
2021-06-04 21:13 ` anlauf at gcc dot gnu.org
2021-06-16 19:54 ` cvs-commit at gcc dot gnu.org
2021-06-16 20:05 ` cvs-commit at gcc dot gnu.org
2021-06-18 18:21 ` cvs-commit at gcc dot gnu.org
2021-06-18 18:42 ` cvs-commit at gcc dot gnu.org
2021-06-18 18:45 ` 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).