[PATCH] Catch more cases when diagnosing integer-constant-expression overflows.

Josh Magee Joshua_Magee at playstation.sony.com
Thu Jan 29 19:22:42 PST 2015


Refreshing a _very_ old patch.

This patch catches more cases of overflow in integer constant expressions and is 
an improvement over the current state.  That said, the robustness of
EvaluateForIntOverflow can be improved by allowing it to handle more than just
BinaryOperator expression (which this patch does not address.)

The changes to catch additional cases of overflow caused a problem in
SemaChecking when synthesizing the imaginary part of complex numbers.
Specifically, it was necessary to handle cases where the LHS is not complex and
also cases where the binary operator is an AssignmentOp.

I think the changes to the complex synthesis code is potentially better split
of as a separate patch, but those changes are only required if the integer
overflow changes go in.  (Similarly, the integer overflow patch needs the
complex changes to get a clean test run.)
 -> In short, I'm happy to split them apart, but I included
 everything as one patch so the context of why I'm proposing the complex related
 changes is clearer.

Thanks,

- Josh


http://reviews.llvm.org/D1238

Files:
  lib/AST/ExprConstant.cpp
  lib/Sema/SemaChecking.cpp
  test/Sema/integer-overflow.c
  test/SemaCXX/integer-overflow.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1238.19020.patch
Type: text/x-patch
Size: 23427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150130/174dc20b/attachment.bin>


More information about the cfe-commits mailing list