[LLVMbugs] [Bug 12255] New: with -fvisibility-inlines-hidden needed copy not emitted for virtual inline function
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Mar 12 11:32:31 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12255
Bug #: 12255
Summary: with -fvisibility-inlines-hidden needed copy not
emitted for virtual inline function
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: l.lunak at suse.cz
CC: l.lunak at suse.cz, llvmbugs at cs.uiuc.edu,
rafael.espindola at gmail.com, sharparrow1 at yahoo.com,
stephan.bergmann.secondary at googlemail.com
Depends on: 11250
Classification: Unclassified
Created attachment 8196
--> http://llvm.org/bugs/attachment.cgi?id=8196
testcase
+++ This bug was initially created as a clone of Bug #11250 +++
This bug is based on bug #11250, which manually marked a base class template as
hidden, resulting in an undefined reference when clang expected to find the
instance of the template in another .so . This bug is the same, except that it
uses the -fvisibility-inlines-hidden option.
In the original testcase, one could argue that the problem is in the source
files and not in clang. In lib2.cc, clang is apparently smart enough to see
that it is not necessary to instantiate S1< int >, because it will be done in
the same place where S2::~S2() is implemented (since S2's vtable is keyed to
it, as the first virtual method in S2, and S2's vtable will require vtable of
S1< int >, which will also instantiate S1< int >::f()). Therefore it could be
argued that it is a developer error to mark S1 as non-exported (especially
since it's done so only in lib1.cc and not in lib2.cc ).
However, this new testcase compiles and links fine as it is, as long as
-fvisibility-inlines-hidden is not used, otherwise the same problem occurs. Now
again lib1.so contains a non-exported instance of S1< int >::f(), because of
the switch.
Presumably when compiling with -fvisibility-inlines-hidden clang should create
a non-exported instance of S1< int >::f() even in lib2.so , otherwise
-fvisibility-inlines-hidden is broken or next to useless.
--
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