public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
@ 2011-07-07 11:19 z0sh at sogetthis dot com
  2011-07-07 11:27 ` [Bug c++/49669] [4.6/4.7 Regression] [C++0x] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: z0sh at sogetthis dot com @ 2011-07-07 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Compiler crashes with "internal compiler error: in
                    perform_member_init, at cp/init.c:530"
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: z0sh@sogetthis.com
              Host: x86
            Target: x86
             Build: x86


Compile this with "g++ -c x.cpp -std=c++0x":

--- BEGIN FILE x.cpp ---
struct Foo { explicit Foo(int) { } };
struct Goo { Goo() : x(Foo(4), Foo(5)) { } Foo x[2]; };
--- END FILE         ---

The compiler (GCC 4.6.0) crashes with this message:

x.cpp: In constructor ‘Goo::Goo()’:
x.cpp:2:38: internal compiler error: in perform_member_init, at cp/init.c:530


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
@ 2011-07-07 11:27 ` redi at gcc dot gnu.org
  2011-07-07 11:50 ` z0sh at sogetthis dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-07-07 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.07 11:27:31
      Known to work|                            |4.5.2
            Summary|Compiler crashes with       |[4.6/4.7 Regression]
                   |"internal compiler error:   |[C++0x] Compiler crashes
                   |in perform_member_init, at  |with "internal compiler
                   |cp/init.c:530"              |error: in
                   |                            |perform_member_init, at
                   |                            |cp/init.c:530"
     Ever Confirmed|0                           |1
      Known to fail|                            |4.6.1, 4.7.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-07 11:27:31 UTC ---
The code is invalid, to initialize the array you need:
   x{Foo(4), Foo(5)} 

4.5 correctly rejects it:
b.cc: In constructor 'Goo::Goo()':
b.cc:2:38: error: bad array initializer


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
  2011-07-07 11:27 ` [Bug c++/49669] [4.6/4.7 Regression] [C++0x] " redi at gcc dot gnu.org
@ 2011-07-07 11:50 ` z0sh at sogetthis dot com
  2011-07-07 12:13 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: z0sh at sogetthis dot com @ 2011-07-07 11:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kerrek SB <z0sh at sogetthis dot com> 2011-07-07 11:49:46 UTC ---
Yes, I know that the code is invalid, but that shouldn't make the compiler
crash, should it?

For that matter, your proposed correct syntax is also rejected by 4.6.0:

Goo::Goo() : x{Foo(4), Foo(5)} { }

"error: invalid initializer for array member ‘Foo Goo::x [2]"


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
  2011-07-07 11:27 ` [Bug c++/49669] [4.6/4.7 Regression] [C++0x] " redi at gcc dot gnu.org
  2011-07-07 11:50 ` z0sh at sogetthis dot com
@ 2011-07-07 12:13 ` redi at gcc dot gnu.org
  2011-07-07 13:19 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-07-07 12:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-07 12:12:26 UTC ---
(In reply to comment #2)
> Yes, I know that the code is invalid, but that shouldn't make the compiler
> crash, should it?

No, that's why I confirmed the bug and marked it as a regression.

> For that matter, your proposed correct syntax is also rejected by 4.6.0:
> 
> Goo::Goo() : x{Foo(4), Foo(5)} { }
> 
> "error: invalid initializer for array member ‘Foo Goo::x [2]"

Yes, but it works with 4.6.1


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (2 preceding siblings ...)
  2011-07-07 12:13 ` redi at gcc dot gnu.org
@ 2011-07-07 13:19 ` rguenth at gcc dot gnu.org
  2011-07-07 16:10 ` z0sh at sogetthis dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-07 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.2


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (3 preceding siblings ...)
  2011-07-07 13:19 ` rguenth at gcc dot gnu.org
@ 2011-07-07 16:10 ` z0sh at sogetthis dot com
  2011-07-07 16:40 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: z0sh at sogetthis dot com @ 2011-07-07 16:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Kerrek SB <z0sh at sogetthis dot com> 2011-07-07 16:09:55 UTC ---
You're right, it works in 4.6.1 - thanks! (Just updated.)

Say, since you're here, if I change the definition of x from "Foo[2]" to
"std::array<Foo,2>", should I be allowed to initialize it with

   Goo::Goo() : x{{Foo(4), Foo(5)}} { }

At the moment, _only_ the following seems to work:

   Goo::Goo() : x({{Foo(4), Foo(5)}}) { }

In particular, initialization of "Foo[2]" and "std::array<Foo,2>" is anything
but "uniform" :-)


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (4 preceding siblings ...)
  2011-07-07 16:10 ` z0sh at sogetthis dot com
@ 2011-07-07 16:40 ` redi at gcc dot gnu.org
  2011-08-01 14:55 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-07-07 16:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-07 16:39:56 UTC ---
(In reply to comment #4)
> Say, since you're here, if I change the definition of x from "Foo[2]" to
> "std::array<Foo,2>", should I be allowed to initialize it with
> 
>    Goo::Goo() : x{{Foo(4), Foo(5)}} { }

I think that should be valid

> At the moment, _only_ the following seems to work:
> 
>    Goo::Goo() : x({{Foo(4), Foo(5)}}) { }

Hmm, that creates a temporary array<Foo,2> and uses that to initialize x, I
don't think that should be necessary.

> In particular, initialization of "Foo[2]" and "std::array<Foo,2>" is anything
> but "uniform" :-)

It will never be completely uniform, because one is an array and one is an
aggregate containing an array, but I think any of these should be valid:

struct Foo { explicit Foo(int) { } };

struct TwoFoo { Foo elems[2]; };

TwoFoo x{ Foo(1), Foo(1) };
TwoFoo y{ { Foo(1), Foo(1) } };
TwoFoo z( { Foo(1), Foo(1) } );    // ?

struct Goo
{
    Foo a[2];
    TwoFoo x, y, z;

    Goo()
        : a{ Foo(1), Foo(2) }
        , x{ Foo(1), Foo(2) }
        , y{ { Foo(1), Foo(2) } }
        , z( { Foo(1), Foo(2) } )  // ?
    { }
};

Jason, when you get around to looking at this ICE, could you comment on the
initialization question above?  Thanks!


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (5 preceding siblings ...)
  2011-07-07 16:40 ` redi at gcc dot gnu.org
@ 2011-08-01 14:55 ` rguenth at gcc dot gnu.org
  2011-08-05 21:22 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-08-01 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (6 preceding siblings ...)
  2011-08-01 14:55 ` rguenth at gcc dot gnu.org
@ 2011-08-05 21:22 ` jason at gcc dot gnu.org
  2011-08-06  4:37 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-05 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-05 21:22:33 UTC ---
TwoFoo z( { Foo(1), Foo(1) } );

is not valid; you can't copy-list-initialize a TwoFoo from { Foo(1), Foo(1) }
because brace elision is not allowed in that context.


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (7 preceding siblings ...)
  2011-08-05 21:22 ` jason at gcc dot gnu.org
@ 2011-08-06  4:37 ` jason at gcc dot gnu.org
  2011-08-06  4:39 ` jason at gcc dot gnu.org
  2011-08-06  8:54 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-06  4:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-06 04:34:33 UTC ---
Author: jason
Date: Sat Aug  6 04:34:29 2011
New Revision: 177497

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177497
Log:
    PR c++/49669
    * init.c (perform_member_init): Handle invalid array initializer.

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


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (8 preceding siblings ...)
  2011-08-06  4:37 ` jason at gcc dot gnu.org
@ 2011-08-06  4:39 ` jason at gcc dot gnu.org
  2011-08-06  8:54 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-06  4:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-06 04:38:19 UTC ---
Author: jason
Date: Sat Aug  6 04:38:16 2011
New Revision: 177501

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177501
Log:
    PR c++/49669
    * init.c (perform_member_init): Handle invalid array initializer.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/init/array28.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/init.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/49669] [4.6/4.7 Regression] [C++0x] Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530"
  2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
                   ` (9 preceding siblings ...)
  2011-08-06  4:39 ` jason at gcc dot gnu.org
@ 2011-08-06  8:54 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-08-06  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-08-06 08:54:17 UTC ---
Fixed for 4.6.2 and 4.7.0.


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

end of thread, other threads:[~2011-08-06  8:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-07 11:19 [Bug c++/49669] New: Compiler crashes with "internal compiler error: in perform_member_init, at cp/init.c:530" z0sh at sogetthis dot com
2011-07-07 11:27 ` [Bug c++/49669] [4.6/4.7 Regression] [C++0x] " redi at gcc dot gnu.org
2011-07-07 11:50 ` z0sh at sogetthis dot com
2011-07-07 12:13 ` redi at gcc dot gnu.org
2011-07-07 13:19 ` rguenth at gcc dot gnu.org
2011-07-07 16:10 ` z0sh at sogetthis dot com
2011-07-07 16:40 ` redi at gcc dot gnu.org
2011-08-01 14:55 ` rguenth at gcc dot gnu.org
2011-08-05 21:22 ` jason at gcc dot gnu.org
2011-08-06  4:37 ` jason at gcc dot gnu.org
2011-08-06  4:39 ` jason at gcc dot gnu.org
2011-08-06  8:54 ` 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).