http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46679
Jay <jay.krell at cornell dot edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|4.5.1 |4.6.0 --- Comment #1 from Jay <jay.krell at cornell dot edu> 2010-12-02 09:08:49 UTC --- You can "prove", almost, the existance of the bug by making this change to slightly increase it: jbook2:gcc jay$ svn diff fold-const.c Index: fold-const.c =================================================================== --- fold-const.c (revision 167194) +++ fold-const.c (working copy) @@ -11648,7 +11648,7 @@ Note that only CEIL_DIV_EXPR and FLOOR_DIV_EXPR are rewritten now. At one time others generated faster code, it's not clear if they do after the last round to changes to the DIV code in expmed.c. */ - if ((code == CEIL_DIV_EXPR || code == FLOOR_DIV_EXPR) + if ((code == CEIL_DIV_EXPR || code == TRUNC_DIV_EXPR || code == FLOOR_DIV_EXPR) && multiple_of_p (type, arg0, arg1)) return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, arg1); it: I don't think C ever produces ceil_div/floor_div, so it's hard to demonstrate. With this, bootstrap fails: /src/gcc-trunk/configure -prefix=/usr/local/gcc-trunk -enable-checking=assert,df,fold,misc,rtl,rtlflag,runtime,tree,types && make -j4 /src/gcc-trunk/gcc/tree-ssa-loop-prefetch.c:1503:1: error: type mismatch in binary expression unsigned int int unsigned int D.55547 = D.55546 /[ex] 16; other than just removing this chunk of code completely, I might suggest checking that arg0 == op0 && arg1 == op1. Though that is probably a bit more conservative than necessary.