The output is different by the optimization.

testcase:
#include <stdio.h>

struct S
{
  unsigned int long long a:33;
};


int main ()
{
  struct S x = { -1 };
  typeof(+x.a) z = x.a+10;
  printf("%llx\n", z);

  return 0;
}

result:
$ g++ bug.cpp; ./a
200000009

$ g++ -O bug.cpp; ./a
9

gcc version: 4.2 20061212


-- 
           Summary: bit-field: optimization BUG?
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          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=30332

Reply via email to