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



             Bug #: 56123

           Summary: Union bitfield corruption

    Classification: Unclassified

           Product: gcc

           Version: unknown

            Status: UNCONFIRMED

          Severity: major

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: t...@gtk.org





Created attachment 29287

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29287

test case with assertion triggered



In this union

union {

  size_t   vsize;

  struct {                               

    uint   field24 : 24;

    uint   unused : 24;

    uint   field16 : 16;

  };

};

"field16" accesses are mismangled, depending on wether "unused" has 24 bits or

is split into two 8+16 components. 

Test case is attached, test it with and without -DNOBUG.



Occours on a 64bit platform with g++-4.6 and 4.7:

$ g++-4.7 --version

g++-4.7 (Ubuntu/Linaro 4.7.2-11precise2) 4.7.2

$ uname -a

Linux jumper 3.2.0-36-generic #57-Ubuntu SMP Tue Jan 8 21:44:52 UTC 2013 x86_64

x86_64 x86_64 GNU/Linux

Reply via email to