[LLVMbugs] [Bug 853] NEW: llvm-gcc4 seems to sometimes generate a bad vtable

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Jul 28 17:51:37 PDT 2006


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

           Summary: llvm-gcc4 seems to sometimes generate a bad vtable
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ribrdb at gmail.com


ribrdb at ribox:/tmp$ cat >inner.cc
#include <strstream> 
  class B : std::ostrstream{
   public:
    B() {}
    B(char* buf, int len, int ctr) : std::ostrstream(buf, len) { }
    virtual int foo() { return 0; }
  };
class A {
 public:
  A() : b((char*)0, 0, 0) { }
  B b;
};
class C : public B {
 public:
  virtual int foo();
};
int C::foo() { return 5;};

int main() {
  A *a = new A();
  B *b = new B((char*)0, 0, 0);
  b->foo();
  a->b.foo();
  return 0;
}
^D
ribrdb at ribox:/tmp$ gcc-3.4 -Wno-deprecated -S inner.cc
ribrdb at ribox:/tmp$ /usr/local/llvm/cfrontend/install/bin/llvm-gcc
-Wno-deprecated -S inner.cc -o inner-llvm.s
inner.cc:29: note: LLVM does not support aliases yet
inner.cc:29: note: LLVM does not support aliases yet
inner.cc:29: note: LLVM does not support aliases yet
inner.cc:29: note: LLVM does not support aliases yet

inner.s contains this vtable:
_ZTV1B:
	.long	56
	.long	0
	.long	_ZTI1B
	.long	_ZN1BD1Ev
	.long	_ZN1BD0Ev
	.long	_ZN1B3fooEv
	.long	-56
	.long	-56
	.long	_ZTI1B
	.long	_ZTv0_n12_N1BD1Ev
	.long	_ZTv0_n12_N1BD0Ev

but inner-llvm.s contains this vtable:
_ZTV1B:				# _ZTV1B
	.size _ZTV1B, 44
	.long	56
	.zero	4
	.long	_ZTI1B
	.long	_ZN1BD1Ev
	.long	_ZN1BD0Ev
	.long	_ZN1B3fooEv
	.long	18446744073709551560
	.long	-56
	.long	_ZTI1B
	.long	_ZTv0_n12_N1BD1Ev
	.long	_ZTv0_n12_N1BD0Ev



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list