public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, committed] PR 89639, fix testcase for targets without REAL128
@ 2021-12-31 22:23 FX
  0 siblings, 0 replies; only message in thread
From: FX @ 2021-12-31 22:23 UTC (permalink / raw)
  To: fortran; +Cc: gcc-patches, dave.anglin

[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

Attached patch pushed as cb48166e52c0f159eb80a0666c4847825e294ec0
Confirmed by Dave to make the testcase pass on hppa-unknown-linux-gnu

FX


[-- Attachment #2: 0001-Fortran-Fix-test-on-targets-without-REAL128.patch --]
[-- Type: application/octet-stream, Size: 4219 bytes --]

From cb48166e52c0f159eb80a0666c4847825e294ec0 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gmail.com>
Date: Fri, 31 Dec 2021 23:19:03 +0100
Subject: [PATCH] Fortran: Fix test on targets without REAL128

REAL128 is a named constant, so we cannot simply use
(REAL128 > 0) to conditionally compile for targets with
REAL128.

gcc/testsuite/ChangeLog:

	PR fortran/89639
	* gfortran.dg/ieee/ieee_9.f90: Adjust test for targets without
	REAL128.
---
 gcc/testsuite/gfortran.dg/ieee/ieee_9.f90 | 90 ++++++++---------------
 1 file changed, 32 insertions(+), 58 deletions(-)

diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90
index 5e0ac36f028..e5935ecd702 100644
--- a/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90
+++ b/gcc/testsuite/gfortran.dg/ieee/ieee_9.f90
@@ -1,71 +1,45 @@
-! { dg-do run { xfail arm*-*-gnueabi arm*-*-gnueabihf } }
-! { dg-skip-if "PR89639" { hppa*-*-linux* } }
+! { dg-do run }
 program foo
    use ieee_arithmetic
    use iso_fortran_env
+   implicit none
+
+   ! This allows us to test REAL128 if it exists, and still compile
+   ! on platforms were it is not present
+   ! https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89639
+   integer, parameter :: large = merge(real128, real64, real128 > 0)
+
    integer i, p
    real x
    x = 4
    i = 4
 
-   if (int8 > 0) then
-      if (real32 > 0) then
-         p = int(ieee_scalb(real(x, real32), int(i, int8)))
-         if (p /= 64) stop 1
-      endif
-      if (real64 > 0) then
-         p = int(ieee_scalb(real(x, real64), int(i, int8)))
-         if (p /= 64) stop 2
-      endif
-      if (real128 > 0) then
-         p = int(ieee_scalb(real(x, real128), int(i, int8)))
-         if (p /= 64) stop 3
-      end if
-   end if
+   p = int(ieee_scalb(real(x, real32), int(i, int8)))
+   if (p /= 64) stop 1
+   p = int(ieee_scalb(real(x, real64), int(i, int8)))
+   if (p /= 64) stop 2
+   p = int(ieee_scalb(real(x, large), int(i, int8)))
+   if (p /= 64) stop 3
 
-   if (int16 > 0) then
-      if (real32 > 0) then
-         p = int(ieee_scalb(real(x, real32), int(i, int16)))
-         if (p /= 64) stop 4
-      endif
-      if (real64 > 0) then
-         p = int(ieee_scalb(real(x, real64), int(i, int16)))
-         if (p /= 64) stop 5
-      endif
-      if (real128 > 0) then
-         p = int(ieee_scalb(real(x, real128), int(i, int16)))
-         if (p /= 64) stop 6
-      end if
-   end if
+   p = int(ieee_scalb(real(x, real32), int(i, int16)))
+   if (p /= 64) stop 4
+   p = int(ieee_scalb(real(x, real64), int(i, int16)))
+   if (p /= 64) stop 5
+   p = int(ieee_scalb(real(x, large), int(i, int16)))
+   if (p /= 64) stop 6
 
-   if (int32 > 0) then
-      if (real32 > 0) then
-         p = int(ieee_scalb(real(x, real32), int(i, int32)))
-         if (p /= 64) stop 7
-      endif
-      if (real64 > 0) then
-         p = int(ieee_scalb(real(x, real64), int(i, int32)))
-         if (p /= 64) stop 8
-      endif
-      if (real128 > 0) then
-         p = int(ieee_scalb(real(x, real128), int(i, int32)))
-         if (p /= 64) stop 9
-      end if
-   end if
+   p = int(ieee_scalb(real(x, real32), int(i, int32)))
+   if (p /= 64) stop 7
+   p = int(ieee_scalb(real(x, real64), int(i, int32)))
+   if (p /= 64) stop 8
+   p = int(ieee_scalb(real(x, large), int(i, int32)))
+   if (p /= 64) stop 9
 
-   if (int64 > 0) then
-      if (real32 > 0) then
-         p = int(ieee_scalb(real(x, real32), int(i, int64)))
-         if (p /= 64) stop 10
-      endif
-      if (real64 > 0) then
-         p = int(ieee_scalb(real(x, real64), int(i, int64)))
-         if (p /= 64) stop 11
-      endif
-      if (real128 > 0) then
-         p = int(ieee_scalb(real(x, real128), int(i, int64)))
-         if (p /= 64) stop 12
-      end if
-   end if
+   p = int(ieee_scalb(real(x, real32), int(i, int64)))
+   if (p /= 64) stop 10
+   p = int(ieee_scalb(real(x, real64), int(i, int64)))
+   if (p /= 64) stop 11
+   p = int(ieee_scalb(real(x, large), int(i, int64)))
+   if (p /= 64) stop 12
 
 end program foo
-- 
2.32.0 (Apple Git-132)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-31 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 22:23 [PATCH, committed] PR 89639, fix testcase for targets without REAL128 FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).