[llvm-bugs] [Bug 27022] New: Using -freg-struct-return and -fno-reg-struct-return compiles can fail
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Mar 21 21:16:26 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27022
Bug ID: 27022
Summary: Using -freg-struct-return and -fno-reg-struct-return
compiles can fail
Product: clang
Version: 3.7
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: wink at saville.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
When I compile any program using clang 3.7.1 with -m64 and -freg-struct-return:
$ clang --version
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ cat t.c
int main(void) {
return 0;
}
I get the error unsupported option even though the compiler is generating the
expected code as defined by System V ABI by default, so this should be trivial
to support:
$ clang -m64 -freg-struct-return t.c
clang-3.7: error: unsupported option '-freg-struct-return' for target
'x86_64-unknown-linux-gnu'
It would also be nice if the -fno-reg-struct-return worked and didn't do the
optimization, but it also complains that the option isn't supported:
$ clang -m64 -fno-reg-struct-return t.c
clang-3.7: error: unsupported option '-fno-reg-struct-return' for target
'x86_64-unknown-linux-gnu'
When compiling 32bit application the -freg-struct-return works and generates
reasonable code:
$ clang -m32 -freg-struct-return t.c
$
But the -fno-reg-struct-return doesn't work, and it too should be trivial as it
is the default case for -m32:
$ clang -m32 -fno-reg-struct-return t.c
clang-3.7: error: unknown argument: '-fno-reg-struct-return'
Note, all combination are accepted with gcc:
$ gcc -m64 -freg-struct-return t.c
$ gcc -m64 -fno-reg-struct-return t.c
$ gcc -m32 -freg-struct-return t.c
$ gcc -m32 -fno-reg-struct-return t.c
$
It should also be noted that in a performance test I created comparing how to
return two values from a function I found that gcc was generating faster code.
This maybe because my test, but I thought I'd note it here.
Here is a link to the performance test:
https://github.com/winksaville/ret_two_values
--
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/20160322/707226b1/attachment-0001.html>
More information about the llvm-bugs
mailing list