[cfe-dev] [BUG] in clang's type system
Alexander Herz
alexander.herz at mytum.de
Tue Aug 24 05:04:39 PDT 2010
Hi,
I found a bug in the types produced by the clang front end when using
different classes that produce the same LLVM type (e.g. pure virtual
classes:
%class.vBase1 = type { i32 (...)** }
%class.vBase2 = type { i32 (...)** }
)
If an object of type vBase1 is instantiated before using vBase2 then
clang will produce a bitcast to vBase1 even if vBase2 is required (line
57 of type_error.s:
%2 = bitcast %class.UES* %this1 to %class.vBase1*, !dbg !47 ;
<%class.vBase1*> [#uses=1]).
I've attached a small example that reproduces the error using the
current svn rev 11805.
I tried to figure out why it gos wrong as well, but quite frankly it's
pretty in-transparent where/how the type for the cast that is incorrect
is stored. How can you retrieve the type name (like class.vBase1) from a
llvm::Type instance? The only thing I can get is "{ i32 (...)** }" which
is not very helpful at all....
As a side note: llvm is a pain in the a** to debug because it's using
all these "super efficient" ...tricks... to store things (small vector,
lsb of pointers etc). It's pretty much impossible to inspect a data
structure and actually get something usefully out of that (yes, you can
do a call Obj->dump() in gdb..that's not nearly as useful!). Since I
don't care about speed in a debug build at all it would be neat of these
tricks were used only for release builds and for debug builds some slow
but plain data structures were used.
Anyways,
it'd be great if someone who knows the type system code better than me
could help me to figure this out and maybe explain to me how the type
name is actually recovered from an llvm::Type instance.
Should I open a bug tracker entry somewhere or such like??
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: type_error.cpp
Type: text/x-c++src
Size: 339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100824/e294204c/attachment.cpp>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: type_error.s
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100824/e294204c/attachment.ksh>
More information about the cfe-dev
mailing list