This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gfortran or tree-ssa bug?


On Sun, Apr 18, 2004 at 09:26:52PM +0100, Paul Brook wrote:
> > Changelog
> >
> > * gfortran.h (struct gfc_option_t): Add gfc_option.warn_underflow.
> > * options.c (gfc_init.options, gfc_handle_option): Use it.
> > * lang.opt: define -Wunderflow
> > * arith.c (eval_intrinsic): Use it.
> > * arith.c, misc.c: typos in comments.
> 
> I think this is the wrong way to handle this. If we detect an underflow we 
> should set the value to zero and return success, possibly after issuing a 
> warning.
> 
> Consider the following code which I believe is legal:
> 
>   real, dimension(10 + int(sqrt(9.125) - 9.125)) :: a
                                        **2

> 
> Paul

I assumed that gfortran implicitly set the target
to 0 due to the underflow.  At least, my test showed
that it did.   I can see were we might wnat to warn
about the underflow and add a flag to suppress the
warn.

Note, I ran the following through NAG's F95 compiler 
and it did not issue an error or warning.

program j
real, dimension(10 + int(sqrt(9.125)**2 - 9.125)) :: a
real, dimension(10) :: b
print *, size(a), size(b)
end program j
rgl[242] ./j
 10 10

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]