On 05/01/2016 12:39 PM, Martin Sebor wrote:
+ if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST) + { + if (tree result = size_binop_loc (EXPR_LOC_OR_LOC (t, input_location), + opcode, arg0, arg1)) + { + if (TREE_OVERFLOW (result)) + { + /* Reset TREE_OVERFLOW to avoid warnings for the overflow. */ + TREE_OVERFLOW (result) = 0; + + return build_complex (TREE_TYPE (t), result, integer_one_node); + } + + return build_complex (TREE_TYPE (t), result, integer_zero_node); + } + }
Should this be in the middle-end somewhere, perhaps shared with fold_builtin_arith_overflow? I notice that the comment for that function says that it folds into normal arithmetic if the operation can never overflow, but I don't see any code that would accomplish that.
Jason