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: [fortran, patch] Don't use huge_val builtins in the front-end


On Sat, Sep 11, 2010 at 05:21:28PM +0200, FX wrote:
> Currently, the code generated for NEAREST is something like:
> 
>   NEAREST(i,j) = nextafter(i, copysign(HUGE_VAL, j)) 
> 
> where HUGE_VAL is a call to one of __builtin_huge_val{f,,l}. This call, which gives a constant result, is immediatly folded by the middle-end. Its value is +Inf if infinities are supported for this type, or the largest representable real otherwise.
> 
> Dominique discovered that this is not handled too well with quad-float, where a __builtin_huge_valq() is available, but not directly from our front-end. While I could fix this, it seems much simpler to emit directly the appropriate real constant from the front-end, in all cases, and get rid of __builtin_huge_val{f,,l}. In addition, there is existing code doing that for generating inline {MIN,MAX}LOC.
> 
> The attached patch creates a new function in trans-const.c (gfc_build_inf_or_huge), which is used in both places.
> It also fixes the testcase gfortran.dg/promotion.f90 which has nothing to do with it, but it a trivial patch (see http://gcc.gnu.org/ml/fortran/2010-09/msg00266.html for details).
> 
> Bootstrapped and regtested on x86_64-linux, both with and without the quad-float patch. OK to commit?
> 

OK.

Thanks for both fixes.

-- 
Steve


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