public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size
@ 2013-11-12 23:13 reichelt at gcc dot gnu.org
  2013-11-13 12:23 ` [Bug c++/59097] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-11-12 23:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59097

            Bug ID: 59097
           Summary: [4.7/4.8/4.9 Regression] ICE with invalid statement
                    expression as array size
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet triggers an ICE since GCC 4.6.0:

============================
void foo()
{
  int x[({ return; })];
}
============================

bug.cc: In function 'void foo()':
bug.cc:3:22: internal compiler error: Segmentation fault
   int x[({ return; })];
                      ^
0xb2bf3f crash_signal
        ../../gcc/gcc/toplev.c:334
0x6dac34 cxx_eval_constant_expression
        ../../gcc/gcc/cp/semantics.c:9350
0x6db91b cxx_eval_constant_expression
        ../../gcc/gcc/cp/semantics.c:9453
0x6de4d6 cxx_eval_outermost_constant_expr
        ../../gcc/gcc/cp/semantics.c:9725
0x6e119b maybe_constant_value(tree_node*)
        ../../gcc/gcc/cp/semantics.c:9835
0x567450 compute_array_index_type(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:8227
0x589075 create_array_type_for_decl
        ../../gcc/gcc/cp/decl.c:8540
0x589075 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/gcc/cp/decl.c:9486
0x58d8f4 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:4469
0x6664a2 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16567
0x667edf cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11107
0x64bdf0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10988
0x64cf13 cp_parser_declaration_statement
        ../../gcc/gcc/cp/parser.c:10635
0x64d587 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9376
0x64e289 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9654
0x64e3fe cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9608
0x661a8b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18461
0x661a8b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18497
0x665e8f cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22520
0x666c62 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22441
Please submit a full bug report, [etc.]


A slightly different testcase produces a different ICE:

============================
void foo()
{
  int x[({ L: ; })];
}
============================

bug.cc: In function 'void foo()':
bug.cc:3:19: internal compiler error: unexpected expression '<statement>' of
kind label_expr
   int x[({ L: ; })];
                   ^
0x6db55d cxx_eval_constant_expression
        ../../gcc/gcc/cp/semantics.c:9705
0x6de4d6 cxx_eval_outermost_constant_expr
        ../../gcc/gcc/cp/semantics.c:9725
0x6e119b maybe_constant_value(tree_node*)
        ../../gcc/gcc/cp/semantics.c:9835
0x567450 compute_array_index_type(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:8227
0x589075 create_array_type_for_decl
        ../../gcc/gcc/cp/decl.c:8540
0x589075 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/gcc/cp/decl.c:9486
0x58d8f4 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:4469
0x6664a2 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16567
0x667edf cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11107
0x64bdf0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10988
0x64cf13 cp_parser_declaration_statement
        ../../gcc/gcc/cp/parser.c:10635
0x64d587 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9376
0x64e289 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9654
0x64e3fe cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9608
0x661a8b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18461
0x661a8b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18497
0x665e8f cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22520
0x666c62 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22441
0x666c62 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16472
0x667edf cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11107
Please submit a full bug report, [etc.]


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

* [Bug c++/59097] [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size
  2013-11-12 23:13 [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size reichelt at gcc dot gnu.org
@ 2013-11-13 12:23 ` rguenth at gcc dot gnu.org
  2014-01-27 15:00 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-11-13 12:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59097

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
   Target Milestone|---                         |4.7.4


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

* [Bug c++/59097] [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size
  2013-11-12 23:13 [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size reichelt at gcc dot gnu.org
  2013-11-13 12:23 ` [Bug c++/59097] " rguenth at gcc dot gnu.org
@ 2014-01-27 15:00 ` jason at gcc dot gnu.org
  2014-01-28  4:31 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-27 15:00 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59097

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-01-27
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
     Ever confirmed|0                           |1


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

* [Bug c++/59097] [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size
  2013-11-12 23:13 [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size reichelt at gcc dot gnu.org
  2013-11-13 12:23 ` [Bug c++/59097] " rguenth at gcc dot gnu.org
  2014-01-27 15:00 ` jason at gcc dot gnu.org
@ 2014-01-28  4:31 ` jason at gcc dot gnu.org
  2014-01-28 13:45 ` jason at gcc dot gnu.org
  2014-01-28 13:52 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-28  4:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59097

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Jan 28 04:30:16 2014
New Revision: 207161

URL: http://gcc.gnu.org/viewcvs?rev=207161&root=gcc&view=rev
Log:
    PR c++/59097
    * decl.c (compute_array_index_type): Don't call
    maybe_constant_value for a non-integral expression.

Added:
    trunk/gcc/testsuite/g++.dg/ext/stmtexpr15.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c


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

* [Bug c++/59097] [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size
  2013-11-12 23:13 [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-01-28  4:31 ` jason at gcc dot gnu.org
@ 2014-01-28 13:45 ` jason at gcc dot gnu.org
  2014-01-28 13:52 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-28 13:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59097

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Jan 28 13:44:30 2014
New Revision: 207184

URL: http://gcc.gnu.org/viewcvs?rev=207184&root=gcc&view=rev
Log:
    PR c++/59097
    * decl.c (compute_array_index_type): Don't call
    maybe_constant_value for a non-integral expression.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/ext/stmtexpr15.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/decl.c


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

* [Bug c++/59097] [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size
  2013-11-12 23:13 [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-01-28 13:45 ` jason at gcc dot gnu.org
@ 2014-01-28 13:52 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2014-01-28 13:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59097

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|4.7.4                       |4.8.3

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.3/4.9.  Not applying to 4.7.


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

end of thread, other threads:[~2014-01-28 13:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-12 23:13 [Bug c++/59097] New: [4.7/4.8/4.9 Regression] ICE with invalid statement expression as array size reichelt at gcc dot gnu.org
2013-11-13 12:23 ` [Bug c++/59097] " rguenth at gcc dot gnu.org
2014-01-27 15:00 ` jason at gcc dot gnu.org
2014-01-28  4:31 ` jason at gcc dot gnu.org
2014-01-28 13:45 ` jason at gcc dot gnu.org
2014-01-28 13:52 ` jason 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).