------- Additional Comments From rakdver at gcc dot gnu dot org 2005-05-22 21:41 ------- As for why we move the division -- most of the time, the behavior described below will not happen. So if we have a reasonable estimate on how long the moved calculation may take (which we have with division), we risk it and move the computation speculatively even if we are not sure whether it will be executed or not.
However the function call may spent arbitrary amount of time, which may be a problem. Furthermore, some programs use more benevolent definitions of "const" and "pure" that cause correctness problems in case non-executed call becomes executed, see PR19828. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21712