[cfe-commits] r107755 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/CodeGen/init.c
John McCall
rjmccall at apple.com
Tue Jul 6 22:08:32 PDT 2010
Author: rjmccall
Date: Wed Jul 7 00:08:32 2010
New Revision: 107755
URL: http://llvm.org/viewvc/llvm-project?rev=107755&view=rev
Log:
Don't consider casted non-global pointers to be evaluatable.
Fixes rdar://problem/8154689
Modified:
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/test/CodeGen/init.c
Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=107755&r1=107754&r2=107755&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Jul 7 00:08:32 2010
@@ -2210,6 +2210,8 @@
} else if (E->getType()->isIntegerType()) {
if (!IntExprEvaluator(Info, Info.EvalResult.Val).Visit(const_cast<Expr*>(E)))
return false;
+ if (Result.Val.isLValue() && !IsGlobalLValue(Result.Val.getLValueBase()))
+ return false;
} else if (E->getType()->hasPointerRepresentation()) {
LValue LV;
if (!EvaluatePointer(E, LV, Info))
Modified: cfe/trunk/test/CodeGen/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/init.c?rev=107755&r1=107754&r2=107755&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/init.c (original)
+++ cfe/trunk/test/CodeGen/init.c Wed Jul 7 00:08:32 2010
@@ -40,3 +40,9 @@
.x = value.x
}};
}
+
+// rdar://problem/8154689
+void f6() {
+ int x;
+ long ids[] = { (long) &x };
+}
More information about the cfe-commits
mailing list