c++/9386: [3.3 regression] anon union cause segfaults (with testcase)

matz@suse.de matz@suse.de
Tue Jan 21 14:16:00 GMT 2003


>Number:         9386
>Category:       c++
>Synopsis:       [3.3 regression] anon union cause segfaults (with testcase)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 21 14:16:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     matz@suse.de
>Release:        3.3 20030113 CVS
>Organization:
>Environment:
x86_64-linux
>Description:
compiling the below snippet with 'g++ -c -O2 bla.ii' segfaults.
I did a small trace of the SEGV, and it happens because lookup_anon_field() return NULL for the requested anon field, because somehow it's called (from build_class_member_access_expr()) with both parameter T and TYPE being the same.  I don't know why.  I _guess_ this might
be a duplicate of 8863, but because of missing attachment there I couldn't check.
---------------
struct Bla
{
  void operator()();
};

struct Adjustment {
  void set_lower(float lower) {changed();}
  union {
    Bla changed;
  };
};
-----------------
>How-To-Repeat:
compile the snippet above
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list