[PATCH] D19048: Test for a module related crash in CGDebugInfo.cpp
Douglas Yung via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 12 20:39:23 PDT 2016
dyung created this revision.
dyung added a reviewer: aprantl.
dyung added a subscriber: cfe-commits.
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.
http://reviews.llvm.org/D19048
Files:
test/Modules/Inputs/getSourceDescriptor-crash/h1.h
test/Modules/Inputs/getSourceDescriptor-crash/module.modulemap
test/Modules/getSourceDescriptor-crash.cpp
Index: test/Modules/getSourceDescriptor-crash.cpp
===================================================================
--- test/Modules/getSourceDescriptor-crash.cpp
+++ test/Modules/getSourceDescriptor-crash.cpp
@@ -0,0 +1,4 @@
+// RUN: %clang -I %S/Inputs/getSourceDescriptor-crash -c -g -fimplicit-module-maps %s
+
+#include "h1.h"
+#include "h1.h"
Index: test/Modules/Inputs/getSourceDescriptor-crash/module.modulemap
===================================================================
--- test/Modules/Inputs/getSourceDescriptor-crash/module.modulemap
+++ test/Modules/Inputs/getSourceDescriptor-crash/module.modulemap
@@ -0,0 +1,3 @@
+module foo {
+ header "h1.h"
+}
\ No newline at end of file
Index: test/Modules/Inputs/getSourceDescriptor-crash/h1.h
===================================================================
--- test/Modules/Inputs/getSourceDescriptor-crash/h1.h
+++ test/Modules/Inputs/getSourceDescriptor-crash/h1.h
@@ -0,0 +1 @@
+#pragma once
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19048.53515.patch
Type: text/x-patch
Size: 970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160413/2be0cb69/attachment.bin>
More information about the cfe-commits
mailing list