------- Comment #7 from guillaume dot melquiond at ens-lyon dot fr 2006-04-11 15:55 ------- > I disagree. Could you give an explicit example?
Sorry, my mistake, I should not have suggested this testcase: this optimization is indeed fine (yet GCC 4.1 does not apply it). The following testcase is not fine though (directly derived from the original testcase): int f(int a, int b) { return (-1 - a) / (-b); } GCC 4.2 generates the division "(a + 1) / b". This optimization is wrong when "a" contains the biggest positive integer. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27116