This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] Fix NEAREST constant folder
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Tobias Schl?ter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: GCC Fortran mailing list <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 10 Apr 2005 08:01:14 -0700
- Subject: Re: [gfortran] Fix NEAREST constant folder
- References: <4259364C.3040109@physik.uni-muenchen.de>
On Sun, Apr 10, 2005 at 04:21:00PM +0200, Tobias Schl?ter wrote:
>
> There's one shortcoming which I enclosed into an #if 0 which I'd like some
> advice on: NEAREST returns the closest machine-representable number which in
> the case of zero are denormals. range_check rejects these. Should I simply
> not range_check (and try to construct the correct value, for which my feeble
> attempt didn't suffice), even though this might lead to underflows in other
> places, or is there an alternative route?
MPFR does not support subnormal numbers, so there isn't much you
can do. If you don't range_check, then underflows elsewhere will
be treated as if you set the result to zero. It's concievable that
someone may use nearest(0,1) to avoid division by zero. So, I
think our only option is to return +-tiny(). I suggest we have
a comment with this info in the source and perhaps issue a warning
that gfortran does not currently support subnormal numbers.
> Bubblestrapped and regtested on i686-linux. Ok together with the testcase?
OK to commit to mainline. OK for 4.0 branch when Mark re-opens the
branch.
--
Steve