------- Comment #3 from jakub at gcc dot gnu dot org 2009-01-16 11:21 ------- -O2 -fno-tree-pre works. tree_could_trap_p is true for integer division by non-constant (or 0), but we don't seem to have stmt_could_trap_p. Perhaps it should be added and PRE should considfer it? In rtl land, may_trap_p is also true in this case and so RTL optimizers don't try to hoist this out of loops.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38819