[LLVMbugs] [Bug 14669] New: CLang's incompatiblity with gcc related to alignment of data fields in structure when passing structure .
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Dec 20 05:56:32 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14669
Bug #: 14669
Summary: CLang's incompatiblity with gcc related to alignment
of data fields in structure when passing structure .
Product: clang
Version: 3.1
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rahul.s1 at samsung.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 9744
--> http://llvm.org/bugs/attachment.cgi?id=9744
The Test files for the issue.
There seems to be some incompatiblity between Clang and Gcc with regard to
alignment of fields inside structure when a structure data is passed from clang
built code to gcc built code and vice-versa.
The attached test clearly shows the difference in alignment when run.
For the test case, g.c file has been compiled with gcc.
c.c file has been compiled with c.c .
And both files pass have function calls to pass arguments to function in other
file.
The execution steps we undertook are as:
clang m.c -c -o m.o
clang c.c -c -o c.o
gcc g.c -c -o g.o
clang m.o c.o g.o -lm -o a.out
./a.out
One separte example is :
struct test{
unsigned long long int a2;
__attribute__((aligned)) char * b;
};
int main(){
int a;
test a1;
a = __alignof__(a1.a2);
}
For gcc, the value of a is 4.
For Clang , the value is 8.
--
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