[cfe-dev] Asserts in Clang crashes my Kdevelop

Reid Kleckner rnk at google.com
Mon Jan 26 13:24:19 PST 2015


On Mon, Jan 26, 2015 at 1:04 PM, Lucas Tanure <tanure at linux.com> wrote:

> Hi,
>
> Newbie here.
> I'm trying to understand a few issues in kdevelop clang plugin, and for
> that I would like to use clang in debug mode.
> But when I compile 3.5.1 for Debug, asserts come too, and this give a
> crash in kdevelop:
> [snip]
> I just want to compile clang in debug mode without asserts.
>

This is just asking to crash later with sigsegv. =/ That particular
assertion is:

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150126/190eb492/attachment.html>


More information about the cfe-dev mailing list