diff mbox series

[OG10,committed] libgomp.oacc-fortran/firstprivate-int.f90 fix for nonexisting kind-16 int

Message ID 6162dfcc-d1e1-41c1-89c2-5ff2053001be@codesourcery.com
State New
Headers show
Series [OG10,committed] libgomp.oacc-fortran/firstprivate-int.f90 fix for nonexisting kind-16 int | expand

Commit Message

Tobias Burnus July 16, 2020, 12:44 p.m. UTC
i386 (alias x86-64 with -m32) does not support integer(kind=16);
this fix simply uses the highest available value in integer_kinds.

This patch still assumes that all offload targets
support at least those ,
but that seems to currently the case. Alternatively,
one could operate with effective-target, but as this
test copy checks data copying, the simple approach is
sufficient.

Committed to the OG10 (devel/omp/gcc-10) branch.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter
diff mbox series

Patch

commit b729ebe99cdbb21bb5afccecd0a284d00a66182d
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Jul 16 14:37:23 2020 +0200

    libgomp.oacc-fortran/firstprivate-int.f90 fix for nonexisting kind-16 int
    
    libgomp/
            * testsuite/libgomp.oacc-fortran/firstprivate-int.f90: Use
            highest available integer kind instead of assuming that kind=16 exists.

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index db1e396b57f..64980dbc38a 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,8 @@ 
+2020-07-16  Tobias Burnus  <tobias@codesourcery.com>
+
+	* testsuite/libgomp.oacc-fortran/firstprivate-int.f90: Use
+	highest available integer kind instead of assuming that kind=16 exists.
+
 2020-07-15  Julian Brown  <julian@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c-c++-common/broadcast-many.c: New test.
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/firstprivate-int.f90 b/libgomp/testsuite/libgomp.oacc-fortran/firstprivate-int.f90
index 3b148ce7517..abc175f37e3 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/firstprivate-int.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/firstprivate-int.f90
@@ -3,19 +3,22 @@ 
 ! { dg-do run }
 
 program test
+  use iso_fortran_env, only: integer_kinds
   implicit none
 
   integer (kind=1)  :: i1i, i1o
   integer (kind=2)  :: i2i, i2o
   integer (kind=4)  :: i4i, i4o
   integer (kind=8)  :: i8i, i8o
-  integer (kind=16) :: i16i, i16o
+! Use highest-precision integer, which might be less than '16'
+! assume integer_kinds == logical_kinds
+  integer (kind=maxval(integer_kinds)) :: i16i, i16o
 
   logical (kind=1)  :: l1i, l1o
   logical (kind=2)  :: l2i, l2o
   logical (kind=4)  :: l4i, l4o
   logical (kind=8)  :: l8i, l8o
-  logical (kind=16) :: l16i, l16o
+  logical (kind=maxval(integer_kinds)) :: l16i, l16o
 
   real (kind=4)  :: r4i, r4o
   real (kind=8)  :: r8i, r8o
@@ -108,19 +111,20 @@  subroutine subtest(i1i, i2i, i4i, i8i, i16i, i1o, i2o, i4o, i8o, i16o, &
                    l1i, l2i, l4i, l8i, l16i, l1o, l2o, l4o, l8o, l16o, &
                    r4i, r8i, r4o, r8o, c4i, c8i, c4o, c8o, &
                    ch1i, ch4i, ch1o, ch4o)
+  use iso_fortran_env, only: integer_kinds
   implicit none
 
   integer (kind=1)  :: i1i, i1o
   integer (kind=2)  :: i2i, i2o
   integer (kind=4)  :: i4i, i4o
   integer (kind=8)  :: i8i, i8o
-  integer (kind=16) :: i16i, i16o
+  integer (kind=maxval(integer_kinds)) :: i16i, i16o
 
   logical (kind=1)  :: l1i, l1o
   logical (kind=2)  :: l2i, l2o
   logical (kind=4)  :: l4i, l4o
   logical (kind=8)  :: l8i, l8o
-  logical (kind=16) :: l16i, l16o
+  logical (kind=maxval(integer_kinds)) :: l16i, l16o
 
   real (kind=4)  :: r4i, r4o
   real (kind=8)  :: r8i, r8o