[Bug c++/71577] New: ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] New: ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

            Bug ID: 71577
           Summary: ICE on invalid C++11 code (with extra struct
                    initializer) on x86_64-linux-gnu: in digest_init_r, at
                    cp/typeck2.c:1117
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following C++11 code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

It is a regression from 6.1.x.


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160617 (experimental) [trunk revision 237557] (GCC)
$
$ g++-6.1 -c small.cpp
small.cpp:1:36: error: too many initializers for ‘<anonymous struct>’
 struct { int a; } s1, s2 = { s1, 0 };
                                    ^
small.cpp:1:36: error: cannot convert ‘<anonymous struct>’ to ‘int’ in
initialization
$
$ g++-trunk -c small.cpp
small.cpp:1:36: error: too many initializers for ‘<anonymous struct>’
 struct { int a; } s1, s2 = { s1, 0 };
                                    ^
small.cpp:1:36: internal compiler error: in digest_init_r, at cp/typeck2.c:1117
0x726db8 digest_init_r
        ../../gcc-source-trunk/gcc/cp/typeck2.c:1117
0x72839a digest_init_flags
        ../../gcc-source-trunk/gcc/cp/typeck2.c:1167
0x72839a store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc-source-trunk/gcc/cp/typeck2.c:796
0x687abc check_initializer
        ../../gcc-source-trunk/gcc/cp/decl.c:6193
0x6b1c0d cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/decl.c:6851
0x7ac1a7 cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:18697
0x7ac9d9 cp_parser_simple_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12378
0x7acce1 cp_parser_block_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12246
0x7b60c0 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12143
0x7b4b94 cp_parser_declaration_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:12022
0x7b4ec8 cp_parser_translation_unit
        ../../gcc-source-trunk/gcc/cp/parser.c:4324
0x7b4ec8 c_parse_file()
        ../../gcc-source-trunk/gcc/cp/parser.c:37486
0x918e02 c_common_parse_file()
        ../../gcc-source-trunk/gcc/c-family/c-opts.c:1070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$


------------------------------------------------------------

// valid in C++11 & okay: struct { int a; } s1, s2 = { s1 };
struct { int a; } s1, s2 = { s1, 0 };
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-06-19
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |msebor at gcc dot gnu.org
            Summary|ICE on invalid C++11 code   |[6/7 regression] ICE on
                   |(with extra struct          |invalid C++11 code (with
                   |initializer) on             |extra struct initializer)
                   |x86_64-linux-gnu: in        |on x86_64-linux-gnu: in
                   |digest_init_r, at           |digest_init_r, at
                   |cp/typeck2.c:1117           |cp/typeck2.c:1117
     Ever confirmed|0                           |1
      Known to fail|                            |6.1.0, 7.0

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The ICE was apparently introduced into 6.0 in r224289:

r224289 | jason | 2015-06-09 12:56:12 -0400 (Tue, 09 Jun 2015) | 4 lines

        DR 1467
        PR c++/51747
        * typeck2.c (digest_init_r): Replace previous change with
        gcc_unreachable.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |6.2
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |error-recovery
           Priority|P3                          |P4
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.2                         |6.3

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 6.2 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 6.2 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 6.2 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 6.2 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.3                         |6.4

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 6.3 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer) on x86_64-linux-gnu: in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7/8 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

--- Comment #8 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri May  5 09:02:22 2017
New Revision: 247630

URL: https://gcc.gnu.org/viewcvs?rev=247630&root=gcc&view=rev
Log:
/cp
2017-05-05  Paolo Carlini  <[hidden email]>

        PR c++/71577
        * decl.c (reshape_init): Unconditionally return error_mark_node
        upon error about too many initializers.

/testsuite
2017-05-05  Paolo Carlini  <[hidden email]>

        PR c++/71577
        * g++.dg/cpp0x/pr71577.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr71577.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[6/7/8 regression] ICE on   |[6/7 regression] ICE on
                   |invalid C++11 code (with    |invalid C++11 code (with
                   |extra struct initializer):  |extra struct initializer):
                   |in digest_init_r, at        |in digest_init_r, at
                   |cp/typeck2.c:1117           |cp/typeck2.c:1117

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Should be fixed in trunk. If everything goes well, a backport seems possible.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.4                         |6.5

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 6.4 is being released, adjusting target milestone.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [6/7 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|6.5                         |7.4

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 6 branch is being closed
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [7 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.4                         |7.5
Reply | Threaded
Open this post in threaded view
|

[Bug c++/71577] [7 regression] ICE on invalid C++11 code (with extra struct initializer): in digest_init_r, at cp/typeck2.c:1117

msebor at gcc dot gnu.org
In reply to this post by msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71577

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |8.0
         Resolution|---                         |FIXED
   Target Milestone|7.5                         |8.0
      Known to fail|                            |7.5.0

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed in GCC8.