[cfe-dev] Asserts in Clang crashes my Kdevelop

Olivier J. G. olivier.jg at gmail.com
Mon Jan 26 23:46:04 PST 2015


>
> void Lexer::lexVerbatimBlockFirstLine(Token &T) {
> again:
>   assert(BufferPtr < CommentEnd);
>
> So, failing that assertion is equivalent to memory OOB access.
>
> Barring an enormous push to stabilize Clang and make it less crashy, you
> have two options:
> 1. Try to recover from assertion failures and segfaults with
> CrashRecoveryContext
> 2. Rig up a separate process to run clang in from kdevelop
>
> A separate process will be more stable but far more effort.
>
> You'd think compilers wouldn't crash very often, but take a look at the
> list of crashers found by AFL:
> http://llvm.org/bugs/buglist.cgi?quicksearch=fuzz&list_id=66187
> While these are all bugs we'd like fixed, it's not clear how soon that
> will happen. Until then, KDevelop and IDEs in general will need to cope
> with compiler crashes somehow.
>
>
While it seems like this assertion failure would lead to a crash, I should
note that I haven't run into any crashes during AST traversal when clang is
in release mode. OTOH, clang compiled in debug mode will fairly regularly
come up with assertions during AST traversal.

For the initial parsing we see plenty of crashes and asserts in both debug
and release, but libclang already runs those in a CrashRecoveryContext, so
it's not usually an issue (unless you're trying to run KDevelop in gdb...).

In short, KDevelop/kdev-clang runs smoothly with release-build clang and is
not really usable when clang is built w/ assertions.

-Olivier JG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150127/a84f2c7e/attachment.html>


More information about the cfe-dev mailing list