Subject: Re: Division by zero doesn't raise SIGFPE
To: Greywolf <firstname.lastname@example.org>
From: Min Sik Kim <email@example.com>
Date: 12/15/2003 17:55:46
On Mon, 15 Dec 2003 15:48:38 -0800 (PST)
Greywolf <firstname.lastname@example.org> wrote:
> 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?)?
In one of directories under my $HOME.
> 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.
Changing return(0) to return(c) only makes this program hangs with
*any* optimization option.
Min Sik Kim