[LLVMbugs] [Bug 18725] New: Struct not passed correctly in vararg
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Feb 4 07:06:57 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18725
Bug ID: 18725
Summary: Struct not passed correctly in vararg
Product: clang
Version: trunk
Hardware: PC
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: ishiura-compiler at ml.kwansei.ac.jp
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang 3.5 (based on LLVM 3.5svn) for x86_64 target miscompiles the following
code.
$ cat error.c
#include <stdarg.h>
struct S { float m0[2]; int m1; };
void func(int x, ... )
{
va_list ap;
va_start(ap, x);
struct S y = va_arg(ap, struct S);
va_end(ap);
if( y.m1 != 1 ) { __builtin_abort(); }
}
int main(void)
{
int x;
struct S s = {{1,1},1};
func(x, s);
return 0;
}
$ clang error.c
$ ./a.out
Abort trap: 6
The value of y.m1 was 1065353216 instead of 1.
There was no problem with an i686 target.
$ clang -v
clang version 3.5 (trunk 200763)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140204/767fcc03/attachment.html>
More information about the llvm-bugs
mailing list