[Patch, Fortran] PR 82143: add a -fdefault-real-16 flag

Janus Weil janus@gcc.gnu.org
Tue Sep 26 09:03:00 GMT 2017


2017-09-26 10:44 GMT+02:00 Janus Weil <janus@gcc.gnu.org>:
> 2017-09-25 23:23 GMT+02:00 Steve Kargl <sgk@troutmask.apl.washington.edu>:
>> On Mon, Sep 25, 2017 at 11:14:42PM +0200, Janus Weil wrote:
>>> 2017-09-25 17:07 GMT+02:00 David Edelsohn <dje.gcc@gmail.com>:
>>> > promotion_3.f90 and promotion_4.f90 are failing on at least PowerPC
>>> > and AArch64.  Are these new tests limited to x86 or some long double
>>> > assumptions?
>>>
>>> These tests require the availability of  a 10- or 16-byte-wide REAL
>>> type, respectively. I have to admit that I do not have a complete
>>> overview of which targets in GCC's wide portfolio provide such a type.
>>>
>>> It seems that REAL(16) is supported via libquadmath on 32-bit x86,
>>> x86-64 and Itanium at least. I'm not sure about REAL(10).
>>>
>>> Targets that do not support such a type probably need to be XFAILed.
>>>
>>
>> Janus, I think you can control with a dg option
>>
>> dg-require-effective-target fortran_large_real
>>
>> See, for example, gfortran.dg/random_3.f90
>
> Thanks for the pointer, Steve.
>
> However, it seems that "fortran_large_real" only requires some real
> type that is larger than 8 byte, but makes no assumptions on its
> actual size (10 or 16 byte). Therefore it's probably not very useful
> for promotion_{3,4}.
>
> But: I found that there's also a "fortran_real_16", which should be
> suitable for promotion_3. Can someone verify if the following fixes
> the problem on the failing targets:
>
> Index: promotion_3.f90
> ===================================================================
> --- promotion_3.f90    (revision 253134)
> +++ promotion_3.f90    (working copy)
> @@ -1,5 +1,6 @@
>  ! { dg-do run }
>  ! { dg-options "-fdefault-real-16" }
> +! { dg-require-effective-target fortran_real_16 }
>  !
>  ! PR 82143: add a -fdefault-real-16 flag
>  !
>
>
> If it does, I'll be happy to commit that. For promotion_4, we probably
> need to add an effective target "fortran_real_10" (which does not seem
> to exists yet).


Attached is a more complete patch, which should fix all problems that
were reported concerning these two test cases. Would be great if
someone could confirm that it works on a failing target (I currently
only have access to x86_64-linux-gnu machines).

Ok for trunk?

Cheers,
Janus
-------------- next part --------------
Index: gcc/testsuite/gfortran.dg/promotion_3.f90
===================================================================
--- gcc/testsuite/gfortran.dg/promotion_3.f90	(revision 253134)
+++ gcc/testsuite/gfortran.dg/promotion_3.f90	(working copy)
@@ -1,5 +1,6 @@
 ! { dg-do run }
 ! { dg-options "-fdefault-real-16" }
+! { dg-require-effective-target fortran_real_16 }
 !
 ! PR 82143: add a -fdefault-real-16 flag
 !
Index: gcc/testsuite/gfortran.dg/promotion_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/promotion_4.f90	(revision 253134)
+++ gcc/testsuite/gfortran.dg/promotion_4.f90	(working copy)
@@ -1,5 +1,6 @@
 ! { dg-do run }
 ! { dg-options "-fdefault-real-10" }
+! { dg-require-effective-target fortran_real_10 }
 !
 ! PR 82143: add a -fdefault-real-16 flag
 !
@@ -12,5 +13,5 @@ double precision :: d
 if (kind(r4) /= 4) call abort
 if (kind(r8) /= 8) call abort
 if (kind(r) /= 10) call abort
-if (kind(d) /= 16) call abort
+if (kind(d)  < 10) call abort
 end
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 253134)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -1464,7 +1464,21 @@ proc check_effective_target_fortran_real_16 { } {
     }]
 }
 
+# Return 1 if the target supports Fortran real kind 10,
+# 0 otherwise. Contrary to check_effective_target_fortran_large_real
+# this checks for real(10) only.
+#
+# When the target name changes, replace the cached result.
 
+proc check_effective_target_fortran_real_10 { } {
+    return [check_no_compiler_messages fortran_real_10 executable {
+	! Fortran
+	real(kind=10) :: x
+	x = cos (x)
+	end
+    }]
+}
+
 # Return 1 if the target supports Fortran's IEEE modules,
 # 0 otherwise.
 #


More information about the Gcc-patches mailing list