In our internal testing, we found a crash in the compiler which was reduced to the attached test case. The issue was "fixed" a while back with Adrian's change in r248069 as the code causing the crash was changed and consequently no longer crashes. The crash occurred in the function CGDebugInfo::EmitImportDecl() in CGDebugInfo.cpp. We did not determine the underlying cause of the crash since it no longer occurs, but wanted to contribute the test case along with some info about it in case anyone might wish to investigate further in case the issue might still exist somewhere.
The function EmitImportDecl contained the following code:
void CGDebugInfo::EmitImportDecl(const ImportDecl &ID) { auto *Reader = CGM.getContext().getExternalSource(); auto Info = Reader->getSourceDescriptor(*ID.getImportedModule());
The crash was because getExternalSource() was returning a null pointer which was assigned into Reader, and when the next line tried to use that pointer, it caused a crash.