This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33887] [4.1/4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jan 2008 17:08:55 -0000
- Subject: [Bug c++/33887] [4.1/4.2/4.3 Regression] Reference to bitfield gets wrong value when optimizing
- References: <bug-33887-1313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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