[LLVMbugs] [Bug 12925] New: always_inline attribute isn't honored when optimizing for code size
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed May 23 09:32:42 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12925
Bug #: 12925
Summary: always_inline attribute isn't honored when optimizing
for code size
Product: new-bugs
Version: trunk
Platform: Sun
OS/Version: Solaris
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sbn at tbricks.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hi!
When building my application on Solaris using clang and libc++ I got linker
error about unresolved symbol which is marked as always_inline.
I was able to minimize it to the following:
$ cat a.cpp
extern unsigned strlen(const char *);
template<class _CharT>
class basic_string
{
public:
__attribute__ ((__always_inline__))
basic_string(_CharT const* __s);
void __init(_CharT const* __s, unsigned __sz);
};
typedef basic_string<char> string;
template <class _CharT>
__attribute__ ((__always_inline__)) inline
basic_string<_CharT>::basic_string(_CharT const* __s)
{
__init(__s, strlen(__s));
}
extern template class basic_string<char>;
struct S
{
virtual char const* get_info() const;
};
struct P
{
S* m_s;
virtual S& get_s() const { return *m_s; }
};
struct I
{
virtual string get_info() const = 0;
};
struct PI : P, I
{
virtual string get_info() const
{
return this->get_s().get_info();
}
};
PI pi;
$ /opt/clang/bin/clang++ -Os -c a.cpp && nm a.o|g UNDEF | gc++filt | grep
basic_string
[47] | 0| 0|NOTY |GLOB |0 |UNDEF
|basic_string<char>::__init(char const*, unsigned int)
[48] | 0| 0|NOTY |GLOB |0 |UNDEF
|basic_string<char>::basic_string(char const*)
$ /opt/clang/bin/clang++ -v
clang version 3.1 (branches/release_31)
Target: i386-pc-solaris2.10
Thread model: posix
As one can see even though basic_string<char> constructor from const char* is
marked as always_inline it nevertheless is undefined.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list