This bug is similar to http://gcc.gnu.org/PR24255 in that instead of passing
the pointer to the variable itself a pointer to a temporary holding the address
of the variable is used.  However, the test case (which I will attach next)
doesn't start failing until the following patch (found with Janis' reghunt
scripts):

2007-10-09  Richard Guenther  <rguent...@suse.de>

        PR middle-end/33692
        * gimplify.c (canonicalize_component_ref): Honor qualifiers
        of referenced structure and component.

        * gcc.dg/pr33692.c: New testcase.


The problematic union looks like:

  union q
  {
    unsigned n;
    unsigned get_n () const { return n; }
  } __attribute__ ((transparent_union));

If I change the second field to basically anything else, the test case passes. 
This seems to be a regression with GCC 4.4, 4.5 and mainline, as it compiles
fine with my GCC 4.3 based system compiler which predates richi's patch.

I'll note this only seems to fail using "g++ -m32 ..." and does not fail when
using -m64.


-- 
           Summary: transparent_union mishandled
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bergner at gcc dot gnu dot org
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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

Reply via email to