[PATCH] D52750: [Diagnostics] Check for integer overflow in array size expressions

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 6 11:07:46 PDT 2018


xbolva00 added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:2232
+
+      if (isa<BinaryOperator>(ArraySize))
+        ArraySize->EvaluateForOverflow(Context);
----------------
xbolva00 wrote:
> Rakete1111 wrote:
> > What's up with this statement? Why is it needed? This won't handle overflows for unary expression for example.
> Ok, I should use Sema::CheckForIntOverflow
> 
> But anyway, CheckForIntOverflow does not care about UnaryOperator either currently :)
Anyway, the negative array size is handled a few lines above.


https://reviews.llvm.org/D52750





More information about the cfe-commits mailing list