http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53805
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-06-29
14:54:21 UTC ---
(In reply to comment #6)
> On Fri, 29 Jun 2012, rguenth at gcc dot gnu.org wrote:
>
> > We happily remove dead trapping statements:
> >
> > void foo(double x, int y)
> > {
> > 1 / x;
>
> Bug with -ftrapping-math. Maybe a known bug - there are plenty of open
> bugs for ways in which -ftrapping-math -frounding-math fail to implement
> standard C semantics - but a bug.
>
> > 1 / y;
>
> Arguably a bug with -ftrapv (again, the option could reasonably be split
> into different cases), but not otherwise.
All CPUs I know trap for 1 / 0, even in the integer division case. -ftrapv
is a completely different story - for it we'd even have to preserve
void foo (int x, int y)
{
x + y;
}