public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
@ 2021-09-28 19:09 gscfq@t-online.de
  2021-09-28 19:41 ` [Bug fortran/102520] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-09-28 19:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102520
           Summary: [10/11/12 Regression] ICE in expand_constructor, at
                    fortran/array.c:1802
           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: ---

Changed between 20200223 (error) and 20200308 (ICE) :


$ cat z1.f90
program p
   type t
   end type
   type(t), parameter :: a(4) = shape(1)
   type(t), parameter :: b(2,2) = reshape(a, [2,2])
   type(t), parameter :: c(2,2) = transpose(b)
end


$ gfortran-12-20210926 -c z1.f90
f951: internal compiler error: Segmentation fault
0xd400cf crash_signal
        ../../gcc/toplev.c:328
0x760928 expand_constructor
        ../../gcc/fortran/array.c:1802
0x76200a gfc_get_array_element
        ../../gcc/fortran/array.c:1852
0x76200a gfc_expand_constructor(gfc_expr*, bool)
        ../../gcc/fortran/array.c:1875
0x798804 gfc_check_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3101
0x798c67 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3127
0x79beb0 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:3173
0x7866a4 variable_decl
        ../../gcc/fortran/decl.c:3012
0x7866a4 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6321
0x7ee813 match_word
        ../../gcc/fortran/parse.c:65
0x7ee813 decode_statement
        ../../gcc/fortran/parse.c:376
0x7f025a next_free
        ../../gcc/fortran/parse.c:1384
0x7f025a next_statement
        ../../gcc/fortran/parse.c:1616
0x7f197b parse_spec
        ../../gcc/fortran/parse.c:4151
0x7f474c parse_progunit
        ../../gcc/fortran/parse.c:6117
0x7f5ed1 gfc_parse_file()
        ../../gcc/fortran/parse.c:6658
0x842daf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
@ 2021-09-28 19:41 ` anlauf at gcc dot gnu.org
  2021-09-28 20:46 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-28 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-09-28
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org

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

Potential (nearly obvious) fix:

diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index b858bada18a..8d66e009f66 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -1798,6 +1805,9 @@ expand_constructor (gfc_constructor_base base)

       e = c->expr;

+      if (e == NULL)
+       return false;
+
       if (empty_constructor)
        empty_ts = e->ts;

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
  2021-09-28 19:41 ` [Bug fortran/102520] " anlauf at gcc dot gnu.org
@ 2021-09-28 20:46 ` anlauf at gcc dot gnu.org
  2021-09-29 18:12 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-28 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |10.4
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
           Priority|P3                          |P4

--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-September/056591.html

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
  2021-09-28 19:41 ` [Bug fortran/102520] " anlauf at gcc dot gnu.org
  2021-09-28 20:46 ` anlauf at gcc dot gnu.org
@ 2021-09-29 18:12 ` cvs-commit at gcc dot gnu.org
  2021-09-30 10:01 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-29 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:5e2adfeed21ee584a82cdcdfa7eed41202eb67cd

commit r12-3967-g5e2adfeed21ee584a82cdcdfa7eed41202eb67cd
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Sep 29 20:11:53 2021 +0200

    Fortran: fix error recovery for invalid constructor

    gcc/fortran/ChangeLog:

            PR fortran/102520
            * array.c (expand_constructor): Do not dereference NULL pointer.

    gcc/testsuite/ChangeLog:

            PR fortran/102520
            * gfortran.dg/pr102520.f90: New test.

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-09-29 18:12 ` cvs-commit at gcc dot gnu.org
@ 2021-09-30 10:01 ` marxin at gcc dot gnu.org
  2021-09-30 18:09 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-30 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Can we close it as fixed, please?

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-09-30 10:01 ` marxin at gcc dot gnu.org
@ 2021-09-30 18:09 ` cvs-commit at gcc dot gnu.org
  2021-09-30 18:12 ` cvs-commit at gcc dot gnu.org
  2021-09-30 18:14 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-30 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:0212bcfc31a938d4b2f247dc42f75b1d523bb1ef

commit r11-9047-g0212bcfc31a938d4b2f247dc42f75b1d523bb1ef
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Sep 29 20:11:53 2021 +0200

    Fortran: fix error recovery for invalid constructor

    gcc/fortran/ChangeLog:

            PR fortran/102520
            * array.c (expand_constructor): Do not dereference NULL pointer.

    gcc/testsuite/ChangeLog:

            PR fortran/102520
            * gfortran.dg/pr102520.f90: New test.

    (cherry picked from commit 5e2adfeed21ee584a82cdcdfa7eed41202eb67cd)

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-09-30 18:09 ` cvs-commit at gcc dot gnu.org
@ 2021-09-30 18:12 ` cvs-commit at gcc dot gnu.org
  2021-09-30 18:14 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-30 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:f653f612a95ab9d54e005fba7ac6bb40ec14ffb9

commit r10-10155-gf653f612a95ab9d54e005fba7ac6bb40ec14ffb9
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Wed Sep 29 20:11:53 2021 +0200

    Fortran: fix error recovery for invalid constructor

    gcc/fortran/ChangeLog:

            PR fortran/102520
            * array.c (expand_constructor): Do not dereference NULL pointer.

    gcc/testsuite/ChangeLog:

            PR fortran/102520
            * gfortran.dg/pr102520.f90: New test.

    (cherry picked from commit 5e2adfeed21ee584a82cdcdfa7eed41202eb67cd)

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

* [Bug fortran/102520] [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802
  2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-09-30 18:12 ` cvs-commit at gcc dot gnu.org
@ 2021-09-30 18:14 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-30 18:14 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #7 from anlauf at gcc dot gnu.org ---
Fixed on affected branches.  Closing.

Thanks for the report!

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

end of thread, other threads:[~2021-09-30 18:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 19:09 [Bug fortran/102520] New: [10/11/12 Regression] ICE in expand_constructor, at fortran/array.c:1802 gscfq@t-online.de
2021-09-28 19:41 ` [Bug fortran/102520] " anlauf at gcc dot gnu.org
2021-09-28 20:46 ` anlauf at gcc dot gnu.org
2021-09-29 18:12 ` cvs-commit at gcc dot gnu.org
2021-09-30 10:01 ` marxin at gcc dot gnu.org
2021-09-30 18:09 ` cvs-commit at gcc dot gnu.org
2021-09-30 18:12 ` cvs-commit at gcc dot gnu.org
2021-09-30 18:14 ` 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).