<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 26, 2015 at 11:46 PM, Olivier J. G. <span dir="ltr"><<a href="mailto:olivier.jg@gmail.com" target="_blank">olivier.jg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div>void Lexer::lexVerbatimBlockFirstLine(Token &T) {</div><div>again:</div><div>  assert(BufferPtr < CommentEnd);</div><div><br></div></div><div>So, failing that assertion is equivalent to memory OOB access.</div><div><br></div><div>Barring an enormous push to stabilize Clang and make it less crashy, you have two options:</div><div>1. Try to recover from assertion failures and segfaults with CrashRecoveryContext</div><div>2. Rig up a separate process to run clang in from kdevelop</div><div><br></div><div>A separate process will be more stable but far more effort.</div><div><br>You'd think compilers wouldn't crash very often, but take a look at the list of crashers found by AFL:</div><div><a href="http://llvm.org/bugs/buglist.cgi?quicksearch=fuzz&list_id=66187" target="_blank">http://llvm.org/bugs/buglist.cgi?quicksearch=fuzz&list_id=66187</a></div><div>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.</div></div></div></div>
<br></blockquote><div><br></div></span><div>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.<br><br></div><div>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...).<br><br></div><div>In short, KDevelop/kdev-clang runs smoothly with release-build clang and is not really usable when clang is built w/ assertions.</div></div></div></div></blockquote><div><br></div><div>Nonetheless, if you can provide us with testcases for the crashes, we'd appreciate them. </div></div></div></div>