Bug 58501 - [c++11] Crash with brace-enclosed initializer as default parameter
Summary: [c++11] Crash with brace-enclosed initializer as default parameter
Status: RESOLVED DUPLICATE of bug 60367
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P2 normal
Target Milestone: 4.7.4
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 59740 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-22 18:35 UTC by Volker Reichelt
Modified: 2014-03-11 21:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.7.0, 4.8.0, 4.9.0
Last reconfirmed: 2014-01-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2013-09-22 18:35:13 UTC
The following valid code snippet (compiled with "-std=gnu++0x") triggers an ICE since GCC 4.7.0:

========================
struct A
{
  ~A();
};

int foo(A = {});

int i = foo();
========================

bug.cc: In function 'void __static_initialization_and_destruction_0(int, int)':
bug.cc:8:13: internal compiler error: in create_tmp_var, at gimplify.c:438
 int i = foo();
             ^
0x95b833 create_tmp_var(tree_node*, char const*)
        ../../gcc/gcc/gimplify.c:438
0x95d10c create_tmp_from_val
        ../../gcc/gcc/gimplify.c:521
0x95d10c lookup_tmp_var
        ../../gcc/gcc/gimplify.c:543
0x95d10c internal_get_tmp_var
        ../../gcc/gcc/gimplify.c:587
0x95dace gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8153
0x966eb9 gimplify_call_expr
        ../../gcc/gcc/gimplify.c:2635
0x95ef88 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7293
0x96a00a gimplify_modify_expr
        ../../gcc/gcc/gimplify.c:4875
0x95e25b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7322
0x9620d6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x95eeaf gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5475
0x95eeaf gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7659
0x9620d6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x95f30b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x95f30b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7711
0x9620d6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x965d65 gimplify_cond_expr
        ../../gcc/gcc/gimplify.c:3315
0x95e292 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**, bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7278
0x9620d6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x965d65 gimplify_cond_expr
        ../../gcc/gcc/gimplify.c:3315
Please submit a full bug report, [etc.]
Comment 1 Volker Reichelt 2013-09-22 18:39:13 UTC
Before GCC 4.7.0 the code was wrongly rejected.
Comment 2 Jonathan Wakely 2014-01-09 17:41:13 UTC
*** Bug 59740 has been marked as a duplicate of this bug. ***
Comment 3 Jonathan Wakely 2014-01-09 17:42:14 UTC
I don't think this can be classed as a regression when the syntax wasn't supported until 4.7.0, so never worked
Comment 4 Volker Reichelt 2014-03-11 21:08:42 UTC
Fixed by Jason's patch for PR60367.
The testcase added there seems to cover the testcase here, so no further action is required. Marking as duplicate then.

*** This bug has been marked as a duplicate of bug 60367 ***