[LLVMbugs] [Bug 5579] New: Incorrect bitfields arithmetic result with llvm-gcc frontend
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Fri Nov 20 20:55:14 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=5579
Summary: Incorrect bitfields arithmetic result with llvm-gcc
frontend
Product: new-bugs
Version: 2.5
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: chenyang at cs.utah.edu
CC: llvmbugs at cs.uiuc.edu, regehr at cs.utah.edu,
jxyang at cs.utah.edu
Seems it's a bug of llvm-gcc frontend. See below:
yang at yang-working:~$ llvm-gcc -O1 -o small_llvm small.c
yang at yang-working:~$ ./small_llvm
g = 0
yang at yang-working:~$ clang -O1 -o small_clang small.c
yang at yang-working:~$ ./small_clang
g = 1
yang at yang-working:~$ cat small.c
#include <stdio.h>
struct S0 {
unsigned f0 : 27;
};
int g = 0;
void foo(void);
void foo()
{
struct S0 s = {20000000};
g = (s.f0) < 0xC0000001L;
}
int main(void)
{
foo();
printf("g = %d\n", g);
return 0;
}
yang at yang-working:~$ llvm-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../llvm-gcc4.2-2.5.source/configure
--prefix=/mounts/zion/disks/0/localhome/tbrethou/2.5/prerelease2/llvm-gcc/obj/../install
--program-prefix=llvm-
--enable-llvm=/localhome/tbrethou/2.5/prerelease2/llvm-2.5/
--disable-bootstrap --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5636) (LLVM build 2.5)
yang at yang-working:~$ clang -v
clang version 1.1 (trunk 85610)
Target: i386-pc-linux-gnu
Thread model: posix
--
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.
More information about the llvm-bugs
mailing list