summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJonathan Roelofs <jonathan@codesourcery.com>2015-06-01 16:23:08 +0000
committerJonathan Roelofs <jonathan@codesourcery.com>2015-06-01 16:23:08 +0000
commit104cbf9c326017bf00c30b04f6cb0cd044925dff (patch)
tree6d10d5702f4954e7d650ad13c7f011dbd7ab3b85 /clang
parent8fcb3986d01603c24f37014a3ca171bf0bc1ad2f (diff)
downloadbcm5719-llvm-104cbf9c326017bf00c30b04f6cb0cd044925dff.tar.gz
bcm5719-llvm-104cbf9c326017bf00c30b04f6cb0cd044925dff.zip
Fix PR21945: Crash in constant evaluator.
Patch by Косов Евгений! llvm-svn: 238758
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ExprConstant.cpp5
-rw-r--r--clang/test/Sema/const-eval.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index d1ec7aea1d2..be24a2ae2c8 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -4276,6 +4276,9 @@ public:
BlockScopeRAII Scope(Info);
const CompoundStmt *CS = E->getSubStmt();
+ if (CS->body_empty())
+ return true;
+
for (CompoundStmt::const_body_iterator BI = CS->body_begin(),
BE = CS->body_end();
/**/; ++BI) {
@@ -4301,6 +4304,8 @@ public:
return false;
}
}
+
+ llvm_unreachable("Return from function from the loop above.");
}
/// Visit a value which is evaluated, but whose value is ignored.
diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c
index 883cced9f3b..5f5b6f3dc19 100644
--- a/clang/test/Sema/const-eval.c
+++ b/clang/test/Sema/const-eval.c
@@ -134,3 +134,6 @@ EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned)&Test50 + 10)) // expected-e
// <rdar://problem/11874571>
EVAL_EXPR(51, 0 != (float)1e99)
+
+// PR21945
+void PR21945() { int i = (({}), 0l); }
OpenPOWER on IntegriCloud