Subject: Re: Division by zero doesn't raise SIGFPE
To: Min Sik Kim <>
From: Greywolf <>
List: current-users
Date: 12/15/2003 15:48:38
Thus spake Min Sik Kim ("MSK> ") sometime Today...

MSK> > Which version of gcc are you using?
MSK> >
MSK> > The above code for me actually returns (exits) 0 unless I compile with
MSK> > -O0, gcc 3.3.2.
MSK> gcc (GCC) 3.3.2 (NetBSD nb1 20031026)
MSK> With optimization, it returns 0, but with -O0 it hangs.
MSK> Did you get a core dump with -O0?


Yes, I got a core dump.

1)  Where are you running this program (i.e. where is it trying to dump
	its core?)?

2)  Change the return(0) to return(c) and you will get an FPE fault
	no matter the optimization level, because -O[1-6] will cause gcc
	to generate compiled code which effectively ignores most of the
	function because you're assigning to but not using any of your
	local variables.

NetBSD: safe ports in a storm.