[PATCH] PR19515, driver crash while handling a clang crash

Robinson, Paul Paul_Robinson at playstation.sony.com
Mon Apr 28 14:57:53 PDT 2014


After a compiler crash (which prints the traceback and so forth),
Driver::generateCompilationDiagnostics calls BuildInputs to get a
list of inputs to pass to the preprocessor.  BuildInputs runs through
the command-line arguments.  If the original command line included
"-lstdc++" this was translated into "-Z-reserved-lib-stdc++" which
is marked with options::LinkerInput, so BuildInputs includes it in
the list of inputs (treating it kind of like an object file).

generateCompilationDiagnostics then wants to filter out inputs the
preprocessor doesn't care about.  The first thing it does is check
for stdin, like so:

  if (!strcmp(it->second->getValue(), "-"))

Sadly, "-Z-reserved-lib-stdc++" is Value-less.  The Values are a
SmallVector, which in this case is empty, so attempting to retrieve
one goes boom.

There's another test immediately afterward, which is

  if (types::getPreprocessedType(it->first) == types::TY_INVALID)

and swapping the order of those tests makes the problem go away.
--paulr

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PR19515.diff
Type: application/octet-stream
Size: 1537 bytes
Desc: PR19515.diff
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140428/0d4d3af4/attachment.obj>


More information about the cfe-commits mailing list