Patchwork [Fortran,committed] Add libquadmath testcase gfortran.dg/quad_2.f90

login
register
mail settings
Submitter Tobias Burnus
Date Nov. 8, 2011, 4:48 p.m.
Message ID <4EB95D57.9000102@net-b.de>
Download mbox | patch
Permalink /patch/124394/
State New
Headers show

Comments

Tobias Burnus - Nov. 8, 2011, 4:48 p.m.
On 11/08/2011 05:10 PM, Janne Blomqvist wrote:
> On Tue, Nov 8, 2011 at 17:41, Rainer Orth<ro@cebitec.uni-bielefeld.de>  wrote:
>> Steve Kargl<sgk@troutmask.apl.washington.edu>  writes:
>>
>>>> Please no: sqrtl is a C99 addition, and we don't want lists of non-C99
>>>> targets in tests that require them.
>>>>
>>> OK, so, then we simply accept that running a regression test
>>> on these targets will always FAIL?  If the answer is 'yes',
>>> then please close this PR because I doubt anyone will implement
>>> sqrtl().
>> No.  AFAICS so far C99 functions have been implemented in
>> intrinsics/c99_functions.c for the benefit of platforms that aren't
>> C99.  Has this policy changed recently?

One possibility would be the following patch. It still checks on all 
systems the I/O for the largest real_kind, but restricts the SQRT test 
to libquadmath.

The restriction is done by doing the calculation on systems which have 
both real-kind 10 and real-kind 16 (besides the standard 4 and 8), which 
should be only the case for libquadmath systems.

Would that be a solution?

Tobias

PS: The qp == 16 test is superfluous.

PPS: The if-condition below will fail as soon as gfortran supports 
another kind of real numbers, e.g. those with RADIX=10, on systems with 
(native) REAL(16) and a libm which lacks support for sqrtl.

         call abort()
     end select

Patch

--- a/gcc/testsuite/gfortran.dg/quad_2.f90
+++ b/gcc/testsuite/gfortran.dg/quad_2.f90
@@ -50,12 +50,14 @@  program test_qp
         if (str2 /= "1.00000000000000000000000000000000000") call abort()
         if (str3 /= "   1.41421356237309504880168872420969798") call 
abort()
         if (str4 /= "1.41421356237309504880168872420969798") call abort()
-       block
+       if (qp == 16 .and. size (real_kinds) >= 4) then
+        block
           real(qp), volatile :: fp2a
           fp2a = 2.0_qp
           fp2a = sqrt (fp2a)
           if (abs (fp2a - fp2) > 
sqrt(2.0_qp)-nearest(sqrt(2.0_qp),-1.0_qp)) call abort()
-       end block
+        end block
+       end if
       case default