[LLVMdev] LLVM asserts

Jim Grosbach grosbach at apple.com
Thu Aug 20 09:46:35 PDT 2009


On Aug 20, 2009, at 7:36 AM, David Greene wrote:

> On Wednesday 19 August 2009 18:17, Chris Lattner wrote:
>
>>> But asserts and aborts don't go through that, right?  What's  
>>> needed is
>>> a way to get those assert and abort messages out to other compiler
>>> components so they have a chance to report them nicely to the user.
>>
>> assert and abort should never happen, just like a null pointer or
>> garbage pointer dereference should never happen.  How are garbage
>> pointer and asserts different?
>
> And programs should never have bugs either.
>
> The reality is, they do.  And when we screw up, we owe it to our users
> to give them as much information as possible and gracefully exit.  We
> can't do that right now with the current LLVM assert/abort scheme.
>

Hi Dave,

These asserts are designed to be disabled entirely in a release build  
of llvm. Why is it so important to you to get user-friendly  
diagnostics for them when they aren't guaranteed to be there at all,  
and you'll likely be getting things like segfaults instead in a  
release build?

Is your primary goal to be able to present a more consistent and  
friendly face to the user even when your application goes completely  
bonkers, does nasty stuff and needs to shut down? Or are you trying to  
use them as user-level diagnostics and continue on with broader  
processing?

If the former, you should probably be catching things like SIGBUS and  
SIGSEGV already. Those errors are equivalent in severity to the sorts  
of things the debug asserts are catching. I'd suggest just adding  
SIGABRT to that list.

If the latter, you're asking for a pretty fundamental change in the  
nature of things, and is why you're getting a ton of resistance.

Regards,
   -Jim



More information about the llvm-dev mailing list