<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 --- - -O2: __always_inline__ does not have effect with visibility attribute hidden."
href="https://llvm.org/bugs/show_bug.cgi?id=29085">29085</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-O2: __always_inline__ does not have effect with visibility attribute hidden.
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>bluechristlove@163.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>Consider the following test case:
[code]
class __attribute__ ((__visibility__("default"))) facet1
{
protected:
__attribute__ ((__visibility__("hidden"), __always_inline__))
explicit facet1(int __refs = 0){}
virtual ~facet1();
};
template <class _CharT >
class __attribute__ ((__visibility__("default"))) money_put
: public facet1
{
public:
__attribute__ ((__visibility__("hidden"), __always_inline__))
explicit money_put(int __refs = 0){}
protected:
__attribute__ ((__visibility__("hidden"), __always_inline__))
~money_put() {}
};
extern template class __attribute__ ((__visibility__("default")))
money_put<char>;
struct Mymon_ : public money_put<char> {
Mymon_(int refs)
: money_put<char>(refs) {}
};
struct Myimon_ : public money_put<char> {
Myimon_(int refs)
: money_put<char>(refs) {}
};
int main(int argc, char *argv[])
{
Mymon_ fac(1);
Myimon_ faci(1);
}
[/code]
when we use clang with O2, clang++ t.cpp -O2 -c
then we grep money_put destructor on the t.o
nm t.o | grep _ZN9money_putIcED2Ev
we will find it:
U _ZN9money_putIcED2Ev
However, because we have __always_inline__, it should be inlined.
If we compile it with O0, it will fine. And if we g++ with O0 / O2, it is fine
too.
One more thing, it we use Clang 3.6 with O2, everything is ok, but Clang 3.8 /
Clang 3.9 / Main trunk fails.
This case can be reproduces on Linux on Power / x86</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>