diff options
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 3 | ||||
-rw-r--r-- | clang/test/CodeGen/exprs.c | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index ef8e2d4c130..6b71d110043 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/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/clang/test/CodeGen/exprs.c b/clang/test/CodeGen/exprs.c index 275c988ab9b..07a9158744b 100644 --- a/clang/test/CodeGen/exprs.c +++ b/clang/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; +} |