This reverts part of the earlier patch for PR52478 which turns out to be not necessary. It also revealed that at least switch expansion builds new arithmetic in signed char - going the -ftrapv expansion way (where we obviously don't have __addvqi3 as C promotes everything to int). We probably should be using unsigned types here.
I chose to do the simple reversion instead of not using trapv optabs for modes < INT_TYPE_SIZE. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2014-07-29 Richard Biener <rguent...@suse.de> PR middle-end/52478 * expr.c (expand_expr_real_2): Revert last change. Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 213119) +++ gcc/expr.c (working copy) @@ -9212,9 +9212,7 @@ expand_expr_real_2 (sepops ops, rtx targ if (modifier == EXPAND_STACK_PARM) target = 0; temp = expand_binop (mode, this_optab, op0, op1, target, - unsignedp, - trapv_binoptab_p (this_optab) - ? OPTAB_LIB : OPTAB_LIB_WIDEN); + unsignedp, OPTAB_LIB_WIDEN); gcc_assert (temp); /* Bitwise operations do not need bitfield reduction as we expect their operands being properly truncated. */