http://llvm.org/bugs/show_bug.cgi?id=14880
Bug #: 14880
Summary: --bitfield code is computed incorrectly
Product: clang
Version: 3.2
Platform: PC
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
Code:
===
#include <stdio.h>
#include <stdlib.h>
struct foo {
int x:31;
int y:1;
};
static void baz(struct foo* f) {
--f->x;
if (f->x < 0)
exit(1);
}
int main() {
struct foo f;
f.x = 1;
f.y = 0;
printf("%d %d\n", f.x, f.y);
baz(&f);
printf("%d %d\n", f.x, f.y);
return 0;
}
===
When compiled with clang 3.2 with -O2 on OSX or on Linux, outputs:
===
1 0
0 -1
===
Should output:
===
1 0
0 0
===
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs