<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Using -freg-struct-return and -fno-reg-struct-return compiles can fail"
href="https://llvm.org/bugs/show_bug.cgi?id=27022">27022</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Using -freg-struct-return and -fno-reg-struct-return compiles can fail
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>wink@saville.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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:
<a href="https://github.com/winksaville/ret_two_values">https://github.com/winksaville/ret_two_values</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>