This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR32239 Use builtin_powi
- From: Tobias Burnus <burnus at net-b dot de>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: Janne Blomqvist <blomqvist dot janne at gmail dot com>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Richard Guenther <rguenther at suse dot de>
- Date: Wed, 27 Jun 2007 11:23:19 +0200
- Subject: Re: [Patch, fortran] PR32239 Use builtin_powi
- References: <46751D54.4040502@gmail.com> <468180E4.2010804@net-b.de>
Tobias Burnus wrote:
> Ok for the trunk. I assume you have regtested it; in any case it builds
> and some limited testing shows no problems.
>
I bootstrapped and regtested it (x86-64/Linux). For -m32 everything is
ok, but for -m64 it fails for:
gfortran.fortran-torture/execute/intrinsic_fraction_exponent.f90's
test_4 (third call).
Instead of:
test_4; x = 1.4012985E-45 y= 0.5000000 z= -148
test_4; y= 1.4012985E-45 |x-y|= 0.000000 |x*1e-6|= 0.000000
the result is:
test_4; x = 1.4012985E-45 y= 0.5000000 z= -148
test_4; y= 0.000000 |x-y|= 1.4012985E-45 |x*1e-6|= 0.000000
and the latter fails because |x-y| > |x*1e-6|.
The dump looks ok:
- y = (y * 2.0e+0) * _gfortran_pow_r4_i4 (2.0e+0, z + -1);
+ y = (y * 2.0e+0) * __builtin_powif (2.0e+0, z + -1);
}
else
{
- y = (y / 2.0e+0) * _gfortran_pow_r4_i4 (2.0e+0, z + 1);
+ y = (y / 2.0e+0) * __builtin_powif (2.0e+0, z + 1);
Thus the builtin_powi gives a different result; I don't see ad hoc
whether both results are ok or whether one implementation has a bug.
Tobias
PS: For completeness the excerpt from the source:
subroutine test_4(x)
real*4 x,y
integer z
y = fraction (x)
z = exponent(x)
if (z .gt. 0) then
y = (y * 2.) * (2. ** (z - 1))
else
y = (y / 2.) * (2. ** (z + 1))
end if
if (abs (x - y) .gt. abs(x * 1e-6)) call abort()
end