This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/33887] [4.1/4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing



------- Comment #21 from rguenth at gcc dot gnu dot org  2008-01-14 17:08 -------
Another testcase we miscompile due to the fact in comment #20  (w/o the
temporary
tmp fold converts the comparison to a comparision with a BIT_FIELD_REF, which
is handled correctly (not optimized)):

extern "C" void abort (void);

struct s 
{
  unsigned long long f1 : 40;
  unsigned int f2 : 24;
};

s sv;

void __attribute__((noinline)) foo(unsigned int i)
{
  unsigned int tmp;
  sv.f2 = i;
  tmp = sv.f2;
  if (tmp != 0)
    abort ();
}

int main()
{
  foo (0xff000000u);
  return 0;
}


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]