This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch,fortran] Fix PR19310 unnecessary error for overflowing results
On Sun, Jun 11, 2006 at 01:52:05AM -0700, Jerry DeLisle wrote:
> :REVIEWMAIL:
>
> Paul Brook wrote:
> >On Saturday 10 June 2006 21:30, Jerry DeLisle wrote:
> >
> >>+ if (mpfr_sgn (f) < 0)
> >>+ real.sign = 1;
> >
> >
> >I think REAL_VALUE_TYPE is supposed to be an opaque type. Use
> >REAL_VALUE_NEGATE here.
> >
> >
>
> I have not found a REAL_VALUE_NEGATE in real.h or real.c
> It gave an error when I tried it.
real.h contains
#define REAL_VALUE_NEGATE(X) \
real_arithmetic2 (NEGATE_EXPR, &(X), NULL)
You probably need to include "real.h" at the top of arith.c.
> >>*************** gfc_range_check (gfc_expr * e)
> >>*** 555,560 ****
> >>--- 555,563 ----
> >> {
> >> arith rc;
> >>
> >>+ if (gfc_option.flag_range_check == 0)
> >>+ return ARITH_OK;
> >>+
> >
> >
> >This makes me nervous. I'd expect overflowed values to be set to +-Inf,
> >like for we set underflowed values to zero.
> >
Jerry, I just realized that the above also disables range checking
for integer types. This may be the cause of Paul's nervousness.
I think we want to continue range checking integers where Inf and
NaN don't apply.
You can move the above conditional into gfc_check_real_range().
Note, in this function we also trying to handle subnormal numbers
to give gradual underflow.
--
Steve