This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/34971] New: bitfield rotates are folded and expanded wrong
- 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: 25 Jan 2008 14:20:55 -0000
- Subject: [Bug middle-end/34971] New: bitfield rotates are folded and expanded wrong
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
struct foo
{
unsigned long long b:40;
} x;
extern void abort (void);
void test1(unsigned long long res)
{
/* Build a rotate expression on a 40 bit argument. */
if ((x.b<<8) + (x.b>>32) != res)
abort ();
}
int main()
{
x.b = 0x0100000001;
test1(0x0000000101);
x.b = 0x0100000000;
test1(0x0000000001);
return 0;
}
Patch to fix the most obvious problems:
http://gcc.gnu.org/ml/gcc-patches/2008-01/msg01224.html
the (maybe better) alternative is to not allow ROTATE_EXPRs that
operate on entities whose precision doesn't match their modes bitsize.
--
Summary: bitfield rotates are folded and expanded wrong
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34971