public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/30302]  New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
@ 2006-12-26 13:21 reichelt at gcc dot gnu dot org
  2006-12-26 13:21 ` [Bug c++/30302] " reichelt at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-12-26 13:21 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code snippet triggers an ICE since GCC 3.0:

==================================
struct A
{
  struct { static int i; };
  void foo() { i; }
};
==================================

bug.cc:3: error: 'int A::<anonymous struct>::i' invalid; an anonymous union can
only have non-static data members
bug.cc: In member function 'void A::foo()':
bug.cc:4: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]


-- 
           Summary: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in
                    anonymous struct
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
@ 2006-12-26 13:21 ` reichelt at gcc dot gnu dot org
  2006-12-26 22:21 ` pinskia at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-12-26 13:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.0.4


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
  2006-12-26 13:21 ` [Bug c++/30302] " reichelt at gcc dot gnu dot org
@ 2006-12-26 22:21 ` pinskia at gcc dot gnu dot org
  2006-12-27  3:16 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-26 22:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-26 22:21 -------
Confirmed, here is the backtrace:
#0  0x00220284 in finish_id_expression (id_expression=0x434e08c0,
decl=0x434dcae0, scope=0x0, idk=0xbfffed68, integral_constant_expression_p=0
'\0', allow_non_integral_constant_expression_p=0 '\0',
non_integral_constant_expression_p=0x434e0959 "", template_p=0 '\0', done=1
'\001', address_p=0 '\0', template_arg_p=0 '\0', error_msg=0xbfffec4c) at
../../gcc/cp/semantics.c:2857
#1  0x0016ef20 in cp_parser_primary_expression (parser=0x434e0940, address_p=0
'\0', cast_p=0 '\0', template_arg_p=0 '\0', idk=0xbfffed68) at
../../gcc/cp/parser.c:3237
#2  0x001717cc in cp_parser_postfix_expression (parser=0x434e0940, address_p=0
'\0', cast_p=0 '\0') at ../../gcc/cp/parser.c:4292
#3  0x00173990 in cp_parser_unary_expression (parser=0x434e0940, address_p=0
'\0', cast_p=0 '\0') at ../../gcc/cp/parser.c:5134
#4  0x00174658 in cp_parser_cast_expression (parser=0x434e0940, address_p=0
'\0', cast_p=0 '\0') at ../../gcc/cp/parser.c:5627
#5  0x001746cc in cp_parser_binary_expression (parser=0x434e0940, cast_p=0
'\0') at ../../gcc/cp/parser.c:5719
#6  0x00174af0 in cp_parser_assignment_expression (parser=0x434e0940, cast_p=0
'\0') at ../../gcc/cp/parser.c:5880
#7  0x00174df4 in cp_parser_expression (parser=0x434e0940, cast_p=0 '\0') at
../../gcc/cp/parser.c:6019
#8  0x00175878 in cp_parser_expression_statement (parser=0x434e0940,
in_statement_expr=0x0) at ../../gcc/cp/parser.c:6453
#9  0x001755ec in cp_parser_statement (parser=0x434e0940,
in_statement_expr=0x0, in_compound=1 '\001', if_p=0x0) at
../../gcc/cp/parser.c:6344
#10 0x00175a70 in cp_parser_statement_seq_opt (parser=0x434e0940,
in_statement_expr=0x0) at ../../gcc/cp/parser.c:6520
#11 0x001759ac in cp_parser_compound_statement (parser=0x434e0940,
in_statement_expr=0x0, in_try=0 '\0') at ../../gcc/cp/parser.c:6490


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-12-26 22:21:22
               date|                            |


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
  2006-12-26 13:21 ` [Bug c++/30302] " reichelt at gcc dot gnu dot org
  2006-12-26 22:21 ` pinskia at gcc dot gnu dot org
@ 2006-12-27  3:16 ` pinskia at gcc dot gnu dot org
  2007-02-03 21:23 ` gdr at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-27  3:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-12-27 03:16 -------
This patch works for me but I don't know if it is correct, it mirrors other
places which uses currently_open_derived_class but we now get a bogus error
message with this patch:
Index: semantics.c
===================================================================
--- semantics.c (revision 120211)
+++ semantics.c (working copy)
@@ -2854,6 +2859,8 @@
              tree path;

              path = currently_open_derived_class (DECL_CONTEXT (decl));
+             if (!path)
+               path = DECL_CONTEXT (decl);
              perform_or_defer_access_check (TYPE_BINFO (path), decl, decl);
            }



-- 


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-12-27  3:16 ` pinskia at gcc dot gnu dot org
@ 2007-02-03 21:23 ` gdr at gcc dot gnu dot org
  2007-02-03 21:24 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 21:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from gdr at gcc dot gnu dot org  2007-02-03 21:22 -------
won't fix in GCC-4.0.x.  Adjusting milestone.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.4                       |4.1.3


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-02-03 21:23 ` gdr at gcc dot gnu dot org
@ 2007-02-03 21:24 ` pinskia at gcc dot gnu dot org
  2007-02-05  5:48 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-03 21:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |4.1.2


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-02-03 21:24 ` pinskia at gcc dot gnu dot org
@ 2007-02-05  5:48 ` mmitchel at gcc dot gnu dot org
  2007-02-14  9:27 ` mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-05  5:48 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-02-05  5:48 ` mmitchel at gcc dot gnu dot org
@ 2007-02-14  9:27 ` mmitchel at gcc dot gnu dot org
  2007-09-03 16:35 ` pcarlini at suse dot de
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-02-14  9:27 ` mmitchel at gcc dot gnu dot org
@ 2007-09-03 16:35 ` pcarlini at suse dot de
  2007-09-05 19:11 ` paolo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: pcarlini at suse dot de @ 2007-09-03 16:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pcarlini at suse dot de  2007-09-03 16:35 -------
On it.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pcarlini at suse dot de
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/30302] [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2007-09-03 16:35 ` pcarlini at suse dot de
@ 2007-09-05 19:11 ` paolo at gcc dot gnu dot org
  2007-09-05 19:12 ` [Bug c++/30302] [4.0/4.1/4.2 " pcarlini at suse dot de
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu dot org @ 2007-09-05 19:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo at gcc dot gnu dot org  2007-09-05 19:10 -------
Subject: Bug 30302

Author: paolo
Date: Wed Sep  5 19:10:48 2007
New Revision: 128145

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128145
Log:
/cp
2007-09-03  Paolo Carlini  <pcarlini@suse.de>

        PR c++/30302
        * semantics.c (finish_id_expression): Check that path != NULL_TREE
        before using TYPE_BINFO on it.
        * class.c (finish_struct_anon): Deal correctly with anonymous
        structs (vs unions, as GNU extension) in error messages.

/testsuite
2007-09-03  Paolo Carlini  <pcarlini@suse.de>

        PR c++/30302
        * g++.dg/ext/anon-struct5.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/ext/anon-struct5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/30302] [4.0/4.1/4.2 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2007-09-05 19:11 ` paolo at gcc dot gnu dot org
@ 2007-09-05 19:12 ` pcarlini at suse dot de
  2008-07-04 21:48 ` [Bug c++/30302] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 20:20 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: pcarlini at suse dot de @ 2007-09-05 19:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pcarlini at suse dot de  2007-09-05 19:12 -------
Fixed in mainline.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|pcarlini at suse dot de     |unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
            Summary|[4.0/4.1/4.2/4.3 regression]|[4.0/4.1/4.2 regression] ICE
                   |ICE with invalid member in  |with invalid member in
                   |anonymous struct            |anonymous struct


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


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

* [Bug c++/30302] [4.2 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2007-09-05 19:12 ` [Bug c++/30302] [4.0/4.1/4.2 " pcarlini at suse dot de
@ 2008-07-04 21:48 ` jsm28 at gcc dot gnu dot org
  2009-03-30 20:20 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2008-07-04 21:47 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 regression] ICE    |[4.2 regression] ICE with
                   |with invalid member in      |invalid member in anonymous
                   |anonymous struct            |struct
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug c++/30302] [4.2 regression] ICE with invalid member in anonymous struct
  2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2008-07-04 21:48 ` [Bug c++/30302] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 20:20 ` jsm28 at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 20:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jsm28 at gcc dot gnu dot org  2009-03-30 20:20 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.0.4                       |4.0.4 4.2.5
      Known to work|                            |4.3.0
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 20:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-26 13:21 [Bug c++/30302] New: [4.0/4.1/4.2/4.3 regression] ICE with invalid member in anonymous struct reichelt at gcc dot gnu dot org
2006-12-26 13:21 ` [Bug c++/30302] " reichelt at gcc dot gnu dot org
2006-12-26 22:21 ` pinskia at gcc dot gnu dot org
2006-12-27  3:16 ` pinskia at gcc dot gnu dot org
2007-02-03 21:23 ` gdr at gcc dot gnu dot org
2007-02-03 21:24 ` pinskia at gcc dot gnu dot org
2007-02-05  5:48 ` mmitchel at gcc dot gnu dot org
2007-02-14  9:27 ` mmitchel at gcc dot gnu dot org
2007-09-03 16:35 ` pcarlini at suse dot de
2007-09-05 19:11 ` paolo at gcc dot gnu dot org
2007-09-05 19:12 ` [Bug c++/30302] [4.0/4.1/4.2 " pcarlini at suse dot de
2008-07-04 21:48 ` [Bug c++/30302] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 20:20 ` jsm28 at gcc dot gnu dot 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).