Bug 29002 - [4.0 regression] ICE on array of ptr-to-member or struct containing ptr-to-member of unknown size
Summary: [4.0 regression] ICE on array of ptr-to-member or struct containing ptr-to-me...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 minor
Target Milestone: 4.0.4
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-invalid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2006-09-10 10:21 UTC by Volker Reichelt
Modified: 2006-10-11 14:56 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.2 4.2.0
Known to fail:
Last reconfirmed: 2006-09-10 13:51:23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-09-10 10:21:13 UTC
The following invalid code snippet triggers an ICE since GCC 3.3:

================
struct A {};
int A::* x[];
================

bug.cc:2: internal compiler error: in build_zero_init, at cp/init.c:226
Please submit a full bug report, [etc.]
Comment 1 Andrew Pinski 2006-09-10 15:41:01 UTC
Another testcase:
struct A {A();int A::* t;};
A x[];
Comment 2 Andrew Pinski 2006-09-10 15:50:55 UTC
I have a fix for both testcases, the problem is the same.
Comment 3 Andrew Pinski 2006-09-15 04:50:14 UTC
Subject: Bug 29002

Author: pinskia
Date: Fri Sep 15 04:50:04 2006
New Revision: 116962

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116962
Log:

2006-09-14  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * init.c (build_zero_init): If we have an error mark node for
        the array size, return.

2006-09-14  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * g++.dg/init/array22.C: New test.
        * g++.dg/init/array23.C: New test.




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

Comment 4 Andrew Pinski 2006-09-15 04:50:36 UTC
Fixed at least on the mainline.
Comment 5 Andrew Pinski 2006-10-07 22:54:17 UTC
Subject: Bug 29002

Author: pinskia
Date: Sat Oct  7 22:54:09 2006
New Revision: 117542

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117542
Log:
2006-10-07 Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * init.c (build_zero_init): If we have an error mark node for
        the array size, return.

2006-10-07  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * g++.dg/init/array22.C: New test.
        * g++.dg/init/array23.C: New test.



Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/init/array22.C
      - copied unchanged from r116962, trunk/gcc/testsuite/g++.dg/init/array22.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/init/array23.C
      - copied unchanged from r116962, trunk/gcc/testsuite/g++.dg/init/array23.C
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/init.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 6 Andrew Pinski 2006-10-07 22:55:49 UTC
Fixed now on the 4.1 branch.
Comment 7 Andrew Pinski 2006-10-11 14:55:18 UTC
Subject: Bug 29002

Author: pinskia
Date: Wed Oct 11 14:55:07 2006
New Revision: 117635

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117635
Log:
2006-10-11  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * init.c (build_zero_init): If we have an error mark node for
        the array size, return.


2006-10-11  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/29002
        * g++.dg/init/array22.C: New test.
        * g++.dg/init/array23.C: New test.



Added:
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/init/array22.C
      - copied unchanged from r116962, trunk/gcc/testsuite/g++.dg/init/array22.C
    branches/gcc-4_0-branch/gcc/testsuite/g++.dg/init/array23.C
      - copied unchanged from r116962, trunk/gcc/testsuite/g++.dg/init/array23.C
Modified:
    branches/gcc-4_0-branch/gcc/cp/ChangeLog
    branches/gcc-4_0-branch/gcc/cp/init.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 8 Andrew Pinski 2006-10-11 14:56:04 UTC
Fixed.