[LLVMbugs] [Bug 6996] New: vtables marked weak_odr instead of	linkonce_odr
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Fri Apr 30 14:09:25 PDT 2010
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=6996
           Summary: vtables marked weak_odr instead of linkonce_odr
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu
In this testcase:
struct A {
  virtual int f() { return 1; }
};
struct B {
  virtual int f() { return 2; }
};
struct C : A, B {
  virtual int f() { return 3; }
};
struct D : C {
  virtual int f() { return 4; }
};
//}
static int f(D* d) {
  B* b = d;
  return b->f();
};
int g() {
  D d;
  return f(&d);
}
The vtables and related gunk are emitted as weak_odr instead of linkonce_odr. 
Because the vtables will be emitted in each translation unit that could
possibly use them (they don't have a key function) they can be linkonce_odr. 
When llvm devirtualizes this example, we end up emitting all the vtables etc
even though they aren't used.
-- 
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