[llvm-bugs] [Bug 42493] New: Passing long double args on 32-bit SPARC violates ABI
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 3 01:28:12 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42493
Bug ID: 42493
Summary: Passing long double args on 32-bit SPARC violates ABI
Product: libraries
Version: trunk
Hardware: Sun
OS: Solaris
Status: NEW
Keywords: ABI, miscompilation
Severity: normal
Priority: P
Component: Backend: Sparc
Assignee: unassignedbugs at nondot.org
Reporter: ro at gcc.gnu.org
CC: llvm-bugs at lists.llvm.org, venkatra at cs.wisc.edu
I'm current working to fix the remaining compiler-rt testsuite bugs on SPARC
(https://reviews.llvm.org/D40900). One of the failures is
Builtins-sparc-sunos :: divtc3_test.c
Builtins-sparcv9-sunos :: divtc3_test.c
While the sparcv9 failure is different, the sparc one boils down to incorrectly
passing long double arguments. Consider the following testcase:
$ cat caller.c
extern void callee (long double);
int
main (void)
{
long double ld = 1.0;
callee (ld);
return 0;
}
$ cat callee.c
extern void abort (void);
void
callee (long double ld)
{
if (ld != 1.0)
abort ();
}
$ clang -m32 -c caller.c -o caller.clang.o
$ clang -m32 -c callee.c -o callee.clang.o
$ gcc -m32 -c caller.c -o caller.gcc.o
$ gcc -m32 -c callee.c -o callee.gcc.o
$ gcc -m32 -o clang-gcc caller.clang.o callee.gcc.o
$ ./clang-gcc
Segmentation Fault (core dumped)
$ gcc -m32 -o gcc-clang caller.gcc.o callee.clang.o
$ ./gcc-clang
Abort (core dumped)
The SPARC psABI, p.3-15 (Structure, Union, and Quad-Precision Arguments)
requires long double args to be passed by reference, while clang passes
them by value (as is correct for SPARCv9).
--
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/20190703/685a3725/attachment-0001.html>
More information about the llvm-bugs
mailing list