[cfe-commits] r124228 - in /cfe/trunk: lib/StaticAnalyzer/SymbolManager.cpp test/Analysis/misc-ps-region-store.m
Ted Kremenek
kremenek at apple.com
Tue Jan 25 13:08:48 PST 2011
Author: kremenek
Date: Tue Jan 25 15:08:47 2011
New Revision: 124228
URL: http://llvm.org/viewvc/llvm-project?rev=124228&view=rev
Log:
Don't try and symbolicate unions; we don't reason
about them yet. Fixes crash reported in PR 9049.
Modified:
cfe/trunk/lib/StaticAnalyzer/SymbolManager.cpp
cfe/trunk/test/Analysis/misc-ps-region-store.m
Modified: cfe/trunk/lib/StaticAnalyzer/SymbolManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/SymbolManager.cpp?rev=124228&r1=124227&r2=124228&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/SymbolManager.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/SymbolManager.cpp Tue Jan 25 15:08:47 2011
@@ -233,13 +233,15 @@
SymbolManager::~SymbolManager() {}
bool SymbolManager::canSymbolicate(QualType T) {
+ T = T.getCanonicalType();
+
if (Loc::IsLocType(T))
return true;
if (T->isIntegerType())
return T->isScalarType();
- if (T->isRecordType())
+ if (T->isRecordType() && !T->isUnionType())
return true;
return false;
Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=124228&r1=124227&r2=124228&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
+++ cfe/trunk/test/Analysis/misc-ps-region-store.m Tue Jan 25 15:08:47 2011
@@ -1217,3 +1217,23 @@
vals[index] = foo_rdar8848957();
return vals[index].x; // no-warning
}
+
+// PR 9049 - crash on symbolicating unions. This test exists solely to
+// test that the analyzer doesn't crash.
+typedef struct pr9048_cdev *pr9048_cdev_t;
+typedef union pr9048_abstracted_disklabel { void *opaque; } pr9048_disklabel_t;
+struct pr9048_diskslice { pr9048_disklabel_t ds_label; };
+struct pr9048_diskslices {
+ int dss_secmult;
+ struct pr9048_diskslice dss_slices[16];
+};
+void pr9048(pr9048_cdev_t dev, struct pr9048_diskslices * ssp, unsigned int slice)
+{
+ pr9048_disklabel_t lp;
+ struct pr9048_diskslice *sp;
+ sp = &ssp->dss_slices[slice];
+ if (ssp->dss_secmult == 1) {
+ } else if ((lp = sp->ds_label).opaque != ((void *) 0)) {
+ }
+}
+
More information about the cfe-commits
mailing list