https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95141
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:cc08609b62ed37d279c986ebb9cb8294eb4e0e3b commit r10-8351-gcc08609b62ed37d279c986ebb9cb8294eb4e0e3b Author: Richard Biener <rguent...@suse.de> Date: Tue May 19 07:58:33 2020 +0200 c/95141 - fix bogus integer overflow warning This fixes an integer overflow warning that ultimatively happens because of TREE_OVERFLOW propagating through transforms and the existing guard against this, 375 if (TREE_OVERFLOW_P (ret) 376 && !TREE_OVERFLOW_P (op0) 377 && !TREE_OVERFLOW_P (op1)) 378 overflow_warning (EXPR_LOC_OR_LOC (expr, input_location, being insufficient. Rather than trying to use sth like walk_tree to exhaustively walk operands (with the possibility of introducing quadraticness when folding larger expressions recursively) the following amends the above with an ad-hoc test for a binary op0 with a possibly constant op1. 2020-05-30 Richard Biener <rguent...@suse.de> PR c/95141 gcc/c * c-fold.c (c_fully_fold_internal): Enhance guard on overflow_warning. gcc/testsuite * gcc.dg/pr95141.c: New testcase.