[cfe-commits] r135519 - in /cfe/trunk: lib/Analysis/UninitializedValues.cpp test/Sema/uninit-variables.c
Ted Kremenek
kremenek at apple.com
Tue Jul 19 13:33:49 PDT 2011
Author: kremenek
Date: Tue Jul 19 15:33:49 2011
New Revision: 135519
URL: http://llvm.org/viewvc/llvm-project?rev=135519&view=rev
Log:
Fix assertion failure in UninitializedValues.cpp where an lvalue to rvalue conversion is wrapped in a parenthesis.
Modified:
cfe/trunk/lib/Analysis/UninitializedValues.cpp
cfe/trunk/test/Sema/uninit-variables.c
Modified: cfe/trunk/lib/Analysis/UninitializedValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/UninitializedValues.cpp?rev=135519&r1=135518&r2=135519&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/UninitializedValues.cpp (original)
+++ cfe/trunk/lib/Analysis/UninitializedValues.cpp Tue Jul 19 15:33:49 2011
@@ -462,7 +462,8 @@
// appropriately, but we need to continue to analyze subsequent uses
// of the variable.
if (init == lastLoad) {
- DeclRefExpr *DR = cast<DeclRefExpr>(lastLoad->getSubExpr());
+ DeclRefExpr *DR =
+ cast<DeclRefExpr>(lastLoad->getSubExpr()->IgnoreParens());
vals[vd] = (DR->getDecl() == vd) ? Uninitialized : Initialized;
lastLoad = 0;
if (lastDR == DR)
@@ -562,7 +563,7 @@
// If we reach here, we have seen a load of an uninitialized value
// and it hasn't been casted to void or otherwise handled. In this
// situation, report the incident.
- DeclRefExpr *DR = cast<DeclRefExpr>(lastLoad->getSubExpr());
+ DeclRefExpr *DR = cast<DeclRefExpr>(lastLoad->getSubExpr()->IgnoreParens());
VarDecl *VD = cast<VarDecl>(DR->getDecl());
reportUninit(DR, VD, isAlwaysUninit(vals[VD]));
lastLoad = 0;
Modified: cfe/trunk/test/Sema/uninit-variables.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/uninit-variables.c?rev=135519&r1=135518&r2=135519&view=diff
==============================================================================
--- cfe/trunk/test/Sema/uninit-variables.c (original)
+++ cfe/trunk/test/Sema/uninit-variables.c Tue Jul 19 15:33:49 2011
@@ -353,6 +353,11 @@
return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
}
+void test53() {
+ int x;
+ int y = (x);
+}
+
// This CFG caused the uninitialized values warning to inf-loop.
extern int PR10379_g();
void PR10379_f(int *len) {
More information about the cfe-commits
mailing list