[LLVMbugs] [Bug 13124] New: Invalid available_externally vtable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 15 21:36:37 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13124

             Bug #: 13124
           Summary: Invalid available_externally vtable
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rafael.espindola at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Given a header foo.h:

----------------------
struct foo {
virtual ~foo();
};
struct bar : public foo {
virtual void anchor();
};
----------------------

and a cpp file:

--------------------------
#include "foo.h"
bar *zed = new bar();
--------------------------

we produce

----------------------------------------------
@_ZTV3bar = available_externally .... @_ZN3barD0Ev
declare void @_ZN3barD0Ev(%struct.bar*)
-------------------------------------------

but given

-----------------------------
#include "foo.h"
void bar::anchor() {
}
----------------------------

we produce

------------------------------
define linkonce_odr void @_ZN3barD0Ev....
-------------------------------

The problem is that the linkonce_odr definition can be dropped from the second
file and the first file can end up with an undefined reference to _ZN3barD0Ev
if it is extracted from the available_externally.

Assuming we really cannot make _ZN3barD0Ev strong (why?), we should probably
emit a linkeonce_odr copy in the first file too.

-- 
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