From: Nuno Lopes Date: Wed, 19 Nov 2008 17:44:31 +0000 (+0000) Subject: fix folding of '*doubleArray' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a468d34bed16861f25aff6c8354f4e75d3358c1a;p=clang fix folding of '*doubleArray' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59647 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index ef8e2d4c13..6b71d11004 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -972,6 +972,9 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) { } bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) { + if (E->getOpcode() == UnaryOperator::Deref) + return false; + if (!EvaluateFloat(E->getSubExpr(), Result, Info)) return false; diff --git a/test/CodeGen/exprs.c b/test/CodeGen/exprs.c index 275c988ab9..07a9158744 100644 --- a/test/CodeGen/exprs.c +++ b/test/CodeGen/exprs.c @@ -45,3 +45,10 @@ int ola() { if ((0, (int)a) & 2) { return 1; } return 2; } + +// this one shouldn't fold as well +void eMaisUma() { + double t[1]; + if (*t) + return; +}