gcc: warn about integer overflow in constant expressions in the C++ frontend.

This fixes GCC 28986:
 http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00473.html

Obtained from:	gcc 4.3 (rev. 120558; GPLv2)
MFC after:	3 weeks
This commit is contained in:
pfg 2013-11-15 03:05:33 +00:00
parent eae6b3d774
commit d712dfff74

View File

@ -3773,6 +3773,12 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
result = fold_if_not_in_template (result);
if (final_type != 0)
result = cp_convert (final_type, result);
if (TREE_OVERFLOW_P (result)
&& !TREE_OVERFLOW_P (op0)
&& !TREE_OVERFLOW_P (op1))
overflow_warning (result);
return result;
}