[LLVMdev] type-system-rewrite branch landing tomorrow

Nick Lewycky nicholas at mxc.ca
Sat Jul 9 14:38:11 PDT 2011


Jay Foad wrote:
>> ... and it's in.  Please let me know if you see any problems.
>
> My clang self-hosted build (Release+Asserts on Release+Asserts, Linux
> x86_64) fails with:
>
> make[2]: Entering directory `/home/jay/llvm/objdir-self/tools/opt'
> llvm[2]: Compiling GraphPrinters.cpp for Debug+Asserts build
> clang: /home/jay/svn/llvm-project/llvm/trunk/include/llvm/Support/Casting.h:194:
> typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&)
> [with X = llvm::FunctionType, Y = llvm::Type*, typename
> llvm::cast_retty<To, From>::ret_type = llvm::FunctionType*]: Assertion
> `isa<X>(Val)&&  "cast<Ty>() argument of incompatible type!"' failed.
>
> This is one of the cases that was giving me grief when I was working
> on the Clang bits! Here's a small C testcase:
>
> $ cat foo.c
> struct S;
> extern struct T {
>    struct S (*p)(void);
> } t;
> struct S { int i; };
> void g(void) {
>    t.p();
> }

Here's a subset of that problem. This C program:

   struct S;
   struct T {
     struct S *s;
   } t;
   struct S { int i; };

produces IR with the definition of both %struct.S and %struct.T. This 
program however:

   struct S;
   struct T {
     struct S (*p)(void);
   } t;
   struct S { int i; };

outputs a "%struct.T = type { {}* }" with no mention of struct S (or for 
that matter, the fact it's a function!)

Nick

> $ clang -cc1 -emit-llvm foo.c
> clang: /home/jay/svn/llvm-project/llvm/trunk/include/llvm/Support/Casting.h:194:
> typename llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&)
> [with X = llvm::FunctionType, Y = llvm::Type*, typename
> llvm::cast_retty<To, From>::ret_type = llvm::FunctionType*]: Assertion
> `isa<X>(Val)&&  "cast<Ty>() argument of incompatible type!"' failed.
>
> Jay.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list