[Bug c++/26534] New: bitfield wrong optimize

s__nakayama at infoseek dot jp gcc-bugzilla@gcc.gnu.org
Thu Mar 2 21:23:00 GMT 2006


#include <stdio.h>
struct X
{
  unsigned a:4;
};

int main()
{
  struct X x = { 63u };
  printf("%u\n", x.a);
  return 0;
}
// end.

result:
g++    bug.cpp; ./a 
15

g++ -O bug.cpp; ./a
63
wrong result!!


-- 
           Summary: bitfield wrong optimize
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s__nakayama at infoseek dot jp


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



More information about the Gcc-bugs mailing list