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:
Pedro F. Giffuni 2013-11-15 03:05:33 +00:00
parent 280c10eba5
commit 57e56fa7b9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=258157

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;
}