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: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>
MSK> gcc (GCC) 3.3.2 (NetBSD nb1 20031026)
MSK>
MSK> With optimization, it returns 0, but with -O0 it hangs.
MSK> Did you get a core dump with -O0?
Hm.
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.
--*greywolf;
--
NetBSD: safe ports in a storm.