<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - tail call applied to __attribute__((no_caller_saved_registers)) negates its purpose"
href="https://bugs.llvm.org/show_bug.cgi?id=51255">51255</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>tail call applied to __attribute__((no_caller_saved_registers)) negates its purpose
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</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>normal
</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>thiago@kde.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>$ clang --version
clang version 12.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ cat test.c
// general-regs-only is helpful with Clang trunk
__attribute__((target("general-regs-only"), no_caller_saved_registers))
int g(int (*f)(void))
{
return f();
}
$ clang -O2 -S -o - -mgeneral-regs-only test.c
[ see result with clang trunk at <a href="https://clang.godbolt.org/z/rMzaPjhn3">https://clang.godbolt.org/z/rMzaPjhn3</a> ]
g(int (*)()): # @g(int (*)())
pushq %r11
pushq %r10
pushq %r9
pushq %r8
pushq %rsi
pushq %rdx
pushq %rcx
pushq %rax
popq %rax
popq %rcx
popq %rdx
popq %rsi
popq %r8
popq %r9
popq %r10
popq %r11
jmpq *%rdi # TAILCALL
The register preservation does not encompass the actual function call.</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>