https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71372
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to rguent...@suse.de from comment #8) > On Thu, 2 Jun 2016, rguenther at suse dot de wrote: > Actually it's not a bug of those but of the callers (given fold_binary > doesn't get to see that flag). Exactly. > > > > see just > > > switch (TREE_CODE_LENGTH (code)) > > > { > > > case 1: > > > op0 = TREE_OPERAND (t, 0); > > > tem = fold_unary_loc (loc, code, type, op0); > > > return tem ? tem : expr; > > > case 2: > > > op0 = TREE_OPERAND (t, 0); > > > op1 = TREE_OPERAND (t, 1); > > > tem = fold_binary_loc (loc, code, type, op0, op1); > > > return tem ? tem : expr; > > > case 3: > > > op0 = TREE_OPERAND (t, 0); > > > op1 = TREE_OPERAND (t, 1); > > > op2 = TREE_OPERAND (t, 2); > > > tem = fold_ternary_loc (loc, code, type, op0, op1, op2); > > > return tem ? tem : expr; > > > without really trying to preserve anything. > > This would need to do the fixup in case of tcc_reference codes. > Fortunately fold () calls are rare. Well, both C and C++ FEs now call them pretty much on everything. So certainly not rare.