public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union
@ 2013-09-23 18:32 reichelt at gcc dot gnu.org
  2013-09-24  7:44 ` [Bug c++/58510] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-09-23 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58510
           Summary: [4.9 regression] [c++0x] ICE with multiple non-static
                    data initializations in union
           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 (compiled with "-std=c++0x") triggers an ICE
on trunk:

========================
void foo()
{
  union
  {
    int i = 0;
    char c = 0;
  };
}
========================

bug.cc: In function 'void foo()':
bug.cc:4:3: error: multiple fields in union 'foo()::<anonymous union>'
initialized
   {
   ^
bug.cc: In constructor 'constexpr foo()::<anonymous union>::<constructor>()':
bug.cc:4:3: error: initializations for multiple members of 'foo()::<anonymous
union>'
bug.cc: In function 'void foo()':
bug.cc:7:4: note: synthesized method 'constexpr foo()::<anonymous
union>::<constructor>()' first required here 
   };
    ^
bug.cc:7:4: internal compiler error: in complete_ctor_at_level_p, at
expr.c:5650
0x89a301 complete_ctor_at_level_p(tree_node const*, long, tree_node const*)
        ../../gcc/gcc/expr.c:5650
0x89a68e categorize_ctor_elements_1
        ../../gcc/gcc/expr.c:5602
0x9684b6 gimplify_init_constructor
        ../../gcc/gcc/gimplify.c:3966
0x96993e gimplify_modify_expr_rhs
        ../../gcc/gcc/gimplify.c:4518
0x969cad gimplify_modify_expr
        ../../gcc/gcc/gimplify.c:4834
0x95e07b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7322
0x961ef6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x95f987 gimplify_and_add
        ../../gcc/gcc/gimplify.c:329
0x95f987 gimplify_decl_expr
        ../../gcc/gcc/gimplify.c:1472
0x95f987 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7489
0x961ef6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x95eccf gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5475
0x95eccf gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7659
0x961ef6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x962bb1 gimplify_bind_expr
        ../../gcc/gcc/gimplify.c:1213
0x95e73f gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7493
0x961ef6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5699
0x963541 gimplify_body(tree_node*, bool)
        ../../gcc/gcc/gimplify.c:8356
0x9639f6 gimplify_function_tree(tree_node*)
        ../../gcc/gcc/gimplify.c:8488
0x7fa9d7 analyze_function
        ../../gcc/gcc/cgraphunit.c:636
Please submit a full bug report, [etc.]


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

* [Bug c++/58510] [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union
  2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
@ 2013-09-24  7:44 ` rguenth at gcc dot gnu.org
  2013-09-24 16:55 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-09-24  7:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0


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

* [Bug c++/58510] [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union
  2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
  2013-09-24  7:44 ` [Bug c++/58510] " rguenth at gcc dot gnu.org
@ 2013-09-24 16:55 ` mpolacek at gcc dot gnu.org
  2013-09-25  9:38 ` [Bug c++/58510] [4.9 Regression] " mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-24 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-24
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed with trunk.


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

* [Bug c++/58510] [4.9 Regression] [c++0x] ICE with multiple non-static data initializations in union
  2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
  2013-09-24  7:44 ` [Bug c++/58510] " rguenth at gcc dot gnu.org
  2013-09-24 16:55 ` mpolacek at gcc dot gnu.org
@ 2013-09-25  9:38 ` mpolacek at gcc dot gnu.org
  2013-09-25  9:47 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r199455.


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

* [Bug c++/58510] [4.9 Regression] [c++0x] ICE with multiple non-static data initializations in union
  2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-09-25  9:38 ` [Bug c++/58510] [4.9 Regression] " mpolacek at gcc dot gnu.org
@ 2013-09-25  9:47 ` mpolacek at gcc dot gnu.org
  2013-10-03 16:33 ` [Bug c++/58510] [4.9 Regression] [c++11] " mpolacek at gcc dot gnu.org
  2013-10-03 16:34 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-09-25  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
At first blush this seems to fix it:

--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -980,9 +980,12 @@ sort_mem_initializers (tree t, tree mem_inits)
              else if (TREE_VALUE (*last_p) && !TREE_VALUE (init))
                goto splice;
              else
-               error_at (DECL_SOURCE_LOCATION (current_function_decl),
-                         "initializations for multiple members of %qT",
-                         ctx);
+               {
+                 error_at (DECL_SOURCE_LOCATION (current_function_decl),
+                           "initializations for multiple members of %qT",
+                           ctx);
+                 goto splice;
+               }
            }

          last_p = p;


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

* [Bug c++/58510] [4.9 Regression] [c++11] ICE with multiple non-static data initializations in union
  2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-09-25  9:47 ` mpolacek at gcc dot gnu.org
@ 2013-10-03 16:33 ` mpolacek at gcc dot gnu.org
  2013-10-03 16:34 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-03 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Oct  3 16:33:23 2013
New Revision: 203165

URL: http://gcc.gnu.org/viewcvs?rev=203165&root=gcc&view=rev
Log:
    PR c++/58510
cp/
    * init.c (sort_mem_initializers): Splice when giving an error.
testsuite/
    * g++.dg/cpp0x/pr58510.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr58510.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58510] [4.9 Regression] [c++11] ICE with multiple non-static data initializations in union
  2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-10-03 16:33 ` [Bug c++/58510] [4.9 Regression] [c++11] " mpolacek at gcc dot gnu.org
@ 2013-10-03 16:34 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-03 16:34 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2013-10-03 16:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-23 18:32 [Bug c++/58510] New: [4.9 regression] [c++0x] ICE with multiple non-static data initializations in union reichelt at gcc dot gnu.org
2013-09-24  7:44 ` [Bug c++/58510] " rguenth at gcc dot gnu.org
2013-09-24 16:55 ` mpolacek at gcc dot gnu.org
2013-09-25  9:38 ` [Bug c++/58510] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-09-25  9:47 ` mpolacek at gcc dot gnu.org
2013-10-03 16:33 ` [Bug c++/58510] [4.9 Regression] [c++11] " mpolacek at gcc dot gnu.org
2013-10-03 16:34 ` mpolacek 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).