public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
@ 2021-02-22 17:02 gscfq@t-online.de
  2021-02-22 18:10 ` [Bug fortran/99206] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2021-02-22 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99206
           Summary: [11 Regression] ICE in add_init_expr_to_sym, at
                    fortran/decl.c:1980
           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 20200823 and 20201004 :
(z1 is invalid, z2 looks valid)


$ cat z1.f90
program p
   character(:), parameter :: a(0) = reshape(['a'], [0])
end


$ cat z2.f90
program p
   character(*), parameter :: a(0) = reshape(['a'], [0])
end


$ gfortran-11-20200823 -c z1.f90
z1.f90:2:34:

    2 |    character(:), parameter :: a(0) = reshape(['a'], [0])
      |                                  1
Error: Entity 'a' at (1) has a deferred type parameter and requires either the
POINTER or ALLOCATABLE attribute


$ gfortran-11-20210221 -c z1.f90
f951: internal compiler error: in add_init_expr_to_sym, at fortran/decl.c:1980
0x66d3e0 add_init_expr_to_sym
        ../../gcc/fortran/decl.c:1980
0x676f8a variable_decl
        ../../gcc/fortran/decl.c:2996
0x676f8a gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6203
0x6db9c3 match_word
        ../../gcc/fortran/parse.c:65
0x6db9c3 decode_statement
        ../../gcc/fortran/parse.c:376
0x6dd40c next_free
        ../../gcc/fortran/parse.c:1316
0x6dd40c next_statement
        ../../gcc/fortran/parse.c:1548
0x6df7d4 parse_spec
        ../../gcc/fortran/parse.c:3783
0x6e184c parse_progunit
        ../../gcc/fortran/parse.c:5896
0x6e2f41 gfc_parse_file()
        ../../gcc/fortran/parse.c:6437
0x72f98f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
@ 2021-02-22 18:10 ` anlauf at gcc dot gnu.org
  2021-02-22 18:20 ` 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-02-22 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |10.2.1
      Known to fail|                            |11.0
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-02-22
   Target Milestone|---                         |11.0

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

gcc-10 emits an appropriate error message for z1 and accepts z2.

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
  2021-02-22 18:10 ` [Bug fortran/99206] " anlauf at gcc dot gnu.org
@ 2021-02-22 18:20 ` anlauf at gcc dot gnu.org
  2021-02-22 20:36 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-22 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
As a sidenote:

  print *, len (reshape (['a'], [0]))
end

This prints 0 for gcc-11, and the correct value 1 for 10.2.1.
Do we screw up things during simplification?

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
  2021-02-22 18:10 ` [Bug fortran/99206] " anlauf at gcc dot gnu.org
  2021-02-22 18:20 ` anlauf at gcc dot gnu.org
@ 2021-02-22 20:36 ` anlauf at gcc dot gnu.org
  2021-02-22 21:15 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-22 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

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 ---
Potential fix that sets the string length (not regtested):

diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 35f267db588..388aca7c38c 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -6887,6 +6887,8 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr
*shape_exp,
                               &source->where);
   if (source->ts.type == BT_DERIVED)
     result->ts.u.derived = source->ts.u.derived;
+  if (source->ts.type == BT_CHARACTER && result->ts.u.cl == NULL)
+    result->ts = source->ts;
   result->rank = rank;
   result->shape = gfc_get_shape (rank);
   for (i = 0; i < rank; i++)

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-02-22 20:36 ` anlauf at gcc dot gnu.org
@ 2021-02-22 21:15 ` anlauf at gcc dot gnu.org
  2021-02-23  8:26 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-22 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-February/055745.html

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-02-22 21:15 ` anlauf at gcc dot gnu.org
@ 2021-02-23  8:26 ` marxin at gcc dot gnu.org
  2021-02-23 18:09 ` cvs-commit at gcc dot gnu.org
  2021-02-23 18:28 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-23  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Just for the record, started with r11-2919-g9d463ce7f983f03f.

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-02-23  8:26 ` marxin at gcc dot gnu.org
@ 2021-02-23 18:09 ` cvs-commit at gcc dot gnu.org
  2021-02-23 18:28 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-23 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r11-7348-ga6c7e0fcffc857e67dffdd7609be663cc3aac7d2
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Feb 23 19:09:14 2021 +0100

    PR fortran/99206 - ICE in add_init_expr_to_sym, at fortran/decl.c:1980

    Make sure that the string length is properly set during simplification
    even when the resulting array is zero-sized.

    gcc/fortran/ChangeLog:

            PR fortran/99206
            * simplify.c (gfc_simplify_reshape): Set string length for
            character arguments.

    gcc/testsuite/ChangeLog:

            PR fortran/99206
            * gfortran.dg/reshape_zerosize_4.f90: New test.

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

* [Bug fortran/99206] [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980
  2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-02-23 18:09 ` cvs-commit at gcc dot gnu.org
@ 2021-02-23 18:28 ` anlauf at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-02-23 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

Thanks for the report!

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

end of thread, other threads:[~2021-02-23 18:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 17:02 [Bug fortran/99206] New: [11 Regression] ICE in add_init_expr_to_sym, at fortran/decl.c:1980 gscfq@t-online.de
2021-02-22 18:10 ` [Bug fortran/99206] " anlauf at gcc dot gnu.org
2021-02-22 18:20 ` anlauf at gcc dot gnu.org
2021-02-22 20:36 ` anlauf at gcc dot gnu.org
2021-02-22 21:15 ` anlauf at gcc dot gnu.org
2021-02-23  8:26 ` marxin at gcc dot gnu.org
2021-02-23 18:09 ` cvs-commit at gcc dot gnu.org
2021-02-23 18:28 ` 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).