questions about PR 14059

Steve Kargl sgk@troutmask.apl.washington.edu
Tue May 18 04:33:00 GMT 2004


On Mon, May 17, 2004 at 09:31:31PM -0700, Steve Kargl wrote:
> 
> 
> 1) I currently unconditionally emit a warning for underflows.
> 
>    program b
>    implicit none
>    real x
>    complex y
>    x = sqrt(9.125)**2 - 9.125                                  
>    y = cabs(cexp((-2.5, 1.375))) - exp(5.0 / (-2.0))
>    print *, 'x = ', x
>    print *, 'y = ', y
>    end program b
> 
>    kargl[205] gfc -o b b.f90
>    In file b.f90:5
> 
>       x = sqrt(9.125)**2 - 9.125                                  
>              1
>    Warning: Arithmetic underflow at (1)
>    In file b.f90:6
> 
>       y = cabs(cexp((-2.5, 1.375))) - exp(5.0 / (-2.0))
>              1
>    Warning: Arithmetic underflow at (1)
> 
> 
>    program n
>    real :: r = 1e-99
>    print *, r
>    end program n
> 
>    kargl[207] gfc -o n n.f90
>    In file n.f90:2
> 
>       real :: r = 1e-99
>                       1
>    Warning: Real constant underflows its kind at (1)
> 
>    The actual value(s) are set exactly to zero.  I think we should
>    issue the warnings unless a user explicitly suppress it.  What 
>    should we call the flag -Wsuppress-underflow, -Wno-underflow, or
>    -Wunderflow-ok?
> 
> 2)  There is weird code in simply.c  The code is
> 
>     static gfc_expr *
>     range_check (gfc_expr * result, const char *name)
>     {
>        if (gfc_range_check (result) == ARITH_OK)
>           return result;
> 
>        gfc_error ("Result of %s overflows its kind at %L", name,
>                    &result->where);
>        gfc_free_expr (result);
>        return &gfc_bad_expr;
>     }
> 
> 
>     Note, the error message explicitly say "Result of %s overflows"
>     

Argh.  I hit send before I finished the question.  Is anyone familiar
with simplify.c?  Is it true that gfc_range_check() can only return
ARITH_OK or ARITH_OVERFLOW?  Do I need to special case ARITH_UNDERFLOW
here?

-- 
Steve



More information about the Fortran mailing list