When for example some call is wrong error message always looks like this: Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i) == Params[i]->getType()) && "Calling a function with a bad signature!"), function init, file /tmp/llvm-svn/llvm/lib/VMCore/Instructions.cpp, line 247. I believe assert() statements should better be replaced with more detailed printouts of what is wrong. This will save many people a lot of debugging time. Yuri
I concur. I've run into this exact assert at least 10 different times in the last two weeks since I started with LLVM as I'm learning the particulars of the typing system for function calls in particular. It would be nice if it would tell you what expected signature was, what the value of i was so you know which parameter went wrong, and what the actual type passed in was, as well as what was expected. You can get this information yourself but it is a real pain. - Curtis On Jun 3, 2010, at 7:36 PM, Yuri wrote:> When for example some call is wrong error message always looks like this: > Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i) == > Params[i]->getType()) && "Calling a function with a bad signature!"), > function init, file /tmp/llvm-svn/llvm/lib/VMCore/Instructions.cpp, line > 247. > > I believe assert() statements should better be replaced with more > detailed printouts of what is wrong. This will save many people a lot of > debugging time. > > Yuri > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
I concur. I've run into this exact assert at least 10 different times in the last two weeks since I started with LLVM as I'm learning the particulars of the typing system for function calls in particular. It would be nice if it would tell you what expected signature was, what the value of i was so you know which parameter went wrong, and what the actual type passed in was, as well as what was expected. You can get this information yourself but it is a real pain. - Curtis P.S. Apologies if this comes through twice. I sent from the wrong account and it went into moderation. On Jun 3, 2010, at 7:36 PM, Yuri wrote:> When for example some call is wrong error message always looks like this: > Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i) == > Params[i]->getType()) && "Calling a function with a bad signature!"), > function init, file /tmp/llvm-svn/llvm/lib/VMCore/Instructions.cpp, line > 247. > > I believe assert() statements should better be replaced with more > detailed printouts of what is wrong. This will save many people a lot of > debugging time. > > Yuri > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Kenneth Uildriks
2010-Jun-04 12:28 UTC
[LLVMdev] Why asserts don't provide much information?
On Thu, Jun 3, 2010 at 10:12 PM, Curtis Faith <curtis at curtisfaith.com> wrote:> I concur. I've run into this exact assert at least 10 different times in the last two weeks since I started with LLVM as I'm learning the particulars of the typing system for function calls in particular. > > It would be nice if it would tell you what expected signature was, what the value of i was so you know which parameter went wrong, and what the actual type passed in was, as well as what was expected. You can get this information yourself but it is a real pain.I've run into it as well, more times than I can count. Now asserts are supposed to be removable, but perhaps an assert that calls a function listing the particulars of the problem could improve things.
Hi Yuri, On Thu, Jun 3, 2010 at 4:36 PM, Yuri <yuri at rawbw.com> wrote:> When for example some call is wrong error message always looks like this: > Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i) => Params[i]->getType()) && "Calling a function with a bad signature!"), > function init, file /tmp/llvm-svn/llvm/lib/VMCore/Instructions.cpp, line > 247. > > I believe assert() statements should better be replaced with more > detailed printouts of what is wrong. This will save many people a lot of > debugging time. >It it the way it is because whoever wrote the assertion felt that it conveyed enough information. However, feel free to send patches to update Assert message where you think the message could be improved. - Devang
On 06/04/10 05:12, Curtis Faith wrote:> I concur. I've run into this exact assert at least 10 different times in the last two weeks since I started with LLVM as I'm learning the particulars of the typing system for function calls in particular. > > It would be nice if it would tell you what expected signature was, what the value of i was so you know which parameter went wrong, and what the actual type passed in was, as well as what was expected. You can get this information yourself but it is a real pain. >Jeffrey Yasskin had a tip some time ago about this particular assertion: "In general, when I hit one of those assertions, I gdb to it, use "p f->dump()" to see the types of the function's arguments, and use "p Params[i]->dump()" to see the parameter with the bad type." HTH, Paul