Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -5240,14 +5240,19 @@ if (E->getBase()->getType()->isVectorType()) return Error(E); - if (!evaluatePointer(E->getBase(), Result)) - return false; + bool Success = true; + if (!evaluatePointer(E->getBase(), Result)) { + if (!Info.noteFailure()) + return false; + Success = false; + } APSInt Index; if (!EvaluateInteger(E->getIdx(), Index, Info)) return false; - return HandleLValueArrayAdjustment(Info, E, Result, E->getType(), Index); + return Success && + HandleLValueArrayAdjustment(Info, E, Result, E->getType(), Index); } bool LValueExprEvaluator::VisitUnaryDeref(const UnaryOperator *E) { Index: test/Sema/integer-overflow.c =================================================================== --- test/Sema/integer-overflow.c +++ test/Sema/integer-overflow.c @@ -147,6 +147,10 @@ uint64_t a[10]; a[4608 * 1024 * 1024] = 1i; +// expected-warning@+2 {{overflow in expression; result is 536870912 with type 'int'}} + uint64_t *b; + uint64_t b2 = b[4608 * 1024 * 1024] + 1; + // expected-warning@+1 2{{overflow in expression; result is 536870912 with type 'int'}} return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024))); }