Subject: Re: Division by zero doesn't raise SIGFPE
To: Min Sik Kim <minskim@bawi.org>
From: Greywolf <greywolf@starwolf.com>
List: current-users
Date: 12/15/2003 15:45:07
Thus spake Greywolf ("G> ") sometime Today...
G> The above code for me actually returns (exits) 0 unless I compile with
G> -O0, gcc 3.3.2.
G>
G> I think this needs to be filed as a bug against gcc.
I forgot that even -O1 will optimize over a routine which doesn't
do anything useful with local variables.
Suggestion: I'm betting that
main()
{
int a = 1, b = 0, c;
c = a / b;
return(c);
}
will FPE on you.
I retract that this is a bug in gcc, although I think optimizing over
something like the previous example is a faux-pas.
--*greywolf;
--
NetBSD: priapic OS