[LLVMdev] Possible bug in TCO?

Jon Harrop jon at ffconsultancy.com
Wed Nov 25 11:19:28 PST 2009


My compiler is generating a bunch of code including the following line:

  %57 = call fastcc i32 @aux(%1* %0, %1 %1, %1 %46, i32 0, %4 %2) ; <i32> 
[#uses=1]
  ret i32 %57

The program works fine as long as this isn't a tail call. If I compile via 
a .ll and insert "tail" by hand, the program segfaults. However, if I make it 
a tail call and return an undef i8* or void instead of the i32 0 then it 
works (the source code is returning the value () of the type unit in ML, so 
it conveys no information and can be returned as anything). That makes me 
think this has been a bug in LLVM rather than in my own code.

I'm using LLVM 2.6. Anyone recognise this as a bug in TCO fixed since then or 
should I try to boil it down and submit it?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list