public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58664] New: [c++11] ICE initializing array of incomplete type within union
@ 2013-10-08 21:01 reichelt at gcc dot gnu.org
  2013-10-08 21:03 ` [Bug c++/58664] " reichelt at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-08 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58664
           Summary: [c++11] ICE initializing array of incomplete type
                    within union
           Product: gcc
           Version: unknown
            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++11") triggers an ICE
since GCC 4.7.0 (when non-static data member initializers were introduced):

=====================
union U
{
  U u[1] = { 0 };
};
=====================

bug.cc:1:7: internal compiler error: Segmentation fault
 union U
       ^
0xaef9cf crash_signal
        ../../gcc/gcc/toplev.c:335
0x90292f contains_struct_check
        ../../gcc/gcc/tree.h:2722
0x90292f size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*)
        ../../gcc/gcc/fold-const.c:1497
0xae7199 place_union_field
        ../../gcc/gcc/stor-layout.c:1038
0xae7199 place_field(record_layout_info_s*, tree_node*)
        ../../gcc/gcc/stor-layout.c:1101
0x5e8b3a layout_nonempty_base_or_field
        ../../gcc/gcc/cp/class.c:4020
0x5f8935 layout_class_type
        ../../gcc/gcc/cp/class.c:6082
0x60402c finish_struct_1(tree_node*)
        ../../gcc/gcc/cp/class.c:6419
0x6063b4 finish_struct(tree_node*, tree_node*)
        ../../gcc/gcc/cp/class.c:6713
0x635a1b cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:18903
0x638370 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:19111
0x638370 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:14090
0x64d879 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11337
0x651929 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10927
0x653950 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10876
0x65c97e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10773
0x65b6ea cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10659
0x65cfb6 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65cfb6 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28911
0x770ac3 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]


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

* [Bug c++/58664] [c++11] ICE initializing array of incomplete type within union
  2013-10-08 21:01 [Bug c++/58664] New: [c++11] ICE initializing array of incomplete type within union reichelt at gcc dot gnu.org
@ 2013-10-08 21:03 ` reichelt at gcc dot gnu.org
  2014-05-18  1:05 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-08 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
      Known to fail|                            |4.7.0, 4.8.0, 4.9.0

--- Comment #1 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Related to PR58596.


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

* [Bug c++/58664] [c++11] ICE initializing array of incomplete type within union
  2013-10-08 21:01 [Bug c++/58664] New: [c++11] ICE initializing array of incomplete type within union reichelt at gcc dot gnu.org
  2013-10-08 21:03 ` [Bug c++/58664] " reichelt at gcc dot gnu.org
@ 2014-05-18  1:05 ` paolo.carlini at oracle dot com
  2014-05-20 13:31 ` paolo at gcc dot gnu.org
  2014-05-20 13:32 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-18  1:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-05-18
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
     Ever confirmed|0                           |1

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/58664] [c++11] ICE initializing array of incomplete type within union
  2013-10-08 21:01 [Bug c++/58664] New: [c++11] ICE initializing array of incomplete type within union reichelt at gcc dot gnu.org
  2013-10-08 21:03 ` [Bug c++/58664] " reichelt at gcc dot gnu.org
  2014-05-18  1:05 ` paolo.carlini at oracle dot com
@ 2014-05-20 13:31 ` paolo at gcc dot gnu.org
  2014-05-20 13:32 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-20 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Tue May 20 13:30:40 2014
New Revision: 210642

URL: http://gcc.gnu.org/viewcvs?rev=210642&root=gcc&view=rev
Log:
/cp
2014-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58664
    * typeck2.c (cxx_incomplete_type_inform): New.
    (cxx_incomplete_type_diagnostic): Use it.
    * decl.c (grokdeclarator): Check the element type of an
    incomplete array type; call the above.
    * cp-tree.h (cxx_incomplete_type_inform): Declare.

/testsuite
2014-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58664
    * g++.dg/cpp0x/nsdmi-union6.C: New.
    * g++.dg/parse/pr58664.C: Likewise.
    * g++.dg/cpp0x/nsdmi6.C: Tweak.
    * g++.dg/parse/crash31.C: Likewise.
    * g++.dg/template/error2.C: Likewise.
    * g++.dg/template/inherit8.C: Likewise.
    * g++.dg/template/offsetof2.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi-union6.C
    trunk/gcc/testsuite/g++.dg/parse/pr58664.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/nsdmi6.C
    trunk/gcc/testsuite/g++.dg/parse/crash31.C
    trunk/gcc/testsuite/g++.dg/template/error2.C
    trunk/gcc/testsuite/g++.dg/template/inherit8.C
    trunk/gcc/testsuite/g++.dg/template/offsetof2.C


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

* [Bug c++/58664] [c++11] ICE initializing array of incomplete type within union
  2013-10-08 21:01 [Bug c++/58664] New: [c++11] ICE initializing array of incomplete type within union reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-05-20 13:31 ` paolo at gcc dot gnu.org
@ 2014-05-20 13:32 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-20 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |4.10.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.10.0.


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

end of thread, other threads:[~2014-05-20 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-08 21:01 [Bug c++/58664] New: [c++11] ICE initializing array of incomplete type within union reichelt at gcc dot gnu.org
2013-10-08 21:03 ` [Bug c++/58664] " reichelt at gcc dot gnu.org
2014-05-18  1:05 ` paolo.carlini at oracle dot com
2014-05-20 13:31 ` paolo at gcc dot gnu.org
2014-05-20 13:32 ` paolo.carlini at oracle dot com

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