------- Comment #2 from raeburn at raeburn dot org 2007-09-02 01:43 ------- After a little more experimentation, it appears that the signed-math cases that do get optimized are those with positive divisors that are not powers of two. If the divisors are powers of two (so that the operations can be done with shifts and masks?), or are negative, then the test and abort call don't get optimized away.
(There's an edge case with INT_MIN/-1 possibly yielding undefined results without -fwrapv. I didn't test -1, but did test a handful of other negative numbers, where the results should be fully defined.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33258