Hi!

This came into existance internally, when the og10 branch was set up.

On 2020-06-03T17:23:51+0200, Tobias Burnus <tobias_bur...@mentor.com> wrote:
> This fixes [...] on OG10 (og10_prerelease); it will be
> later applied to gcn/… to fix the issue. (Upstream is unaffected.)
> [...]

However, that means that your testcase does work on master branch (and
would regress if certain commits got pushed there).  As the testcase has
got a property useful for a thing I'm currently working on, I've pushed
to master branch "Add 'libgomp.oacc-fortran/privatized-ref-2.f90'" in
commit 61796dc03befa9b7426d5bc7c336cca585944143, and "Don't skip
'libgomp.oacc-fortran/privatized-ref-2.f90' for nvptx offloading" in
commit 5d42db533324e80a7382b20b94cace5b202d41ea, see attached.


I confirm that "FIXME: Fails due to PR middle-end/95499" is still a
problem.

And, GCC '-O' reports:

    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:147:21:

      147 |   subroutine foobar15 (scalar)
          |                     ^
    Warning: ‘foobar15’ defined but not used [-Wunused-function]
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90: In function ‘MAIN__’:
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: ‘a.offset’ 
is used uninitialized [-Wuninitialized]
       31 |   A = [(3*j, j=1, 10)]
          |                      ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared 
here
       27 |   integer, allocatable :: A(:)
          |                              ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: 
‘a.dim[0].lbound’ is used uninitialized [-Wuninitialized]
       31 |   A = [(3*j, j=1, 10)]
          |                      ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared 
here
       27 |   integer, allocatable :: A(:)
          |                              ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:31:22: warning: 
‘a.dim[0].ubound’ is used uninitialized [-Wuninitialized]
       31 |   A = [(3*j, j=1, 10)]
          |                      ^
    [...]/libgomp.oacc-fortran/privatized-ref-2.f90:27:30: note: ‘a’ declared 
here
       27 |   integer, allocatable :: A(:)
          |                              ^

I haven't looked into these.


Grüße
 Thomas


-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München 
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank 
Thürauf
>From 61796dc03befa9b7426d5bc7c336cca585944143 Mon Sep 17 00:00:00 2001
From: Tobias Burnus <tob...@codesourcery.com>
Date: Wed, 3 Jun 2020 15:35:12 +0200
Subject: [PATCH 1/2] Add 'libgomp.oacc-fortran/privatized-ref-2.f90'

	libgomp/
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: New.
---
 .../libgomp.oacc-fortran/privatized-ref-2.f90 | 101 ++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
new file mode 100644
index 00000000000..6c3e1dcc211
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -0,0 +1,101 @@
+! { dg-do run { target { ! openacc_nvidia_accel_selected } } }
+
+program main
+  implicit none (type, external)
+  integer :: j
+  integer, allocatable :: A(:)
+  character(len=:), allocatable :: my_str
+  character(len=15), allocatable :: my_str15
+
+  A = [(3*j, j=1, 10)]
+  call foo (A, size(A))
+  call bar (A)
+  my_str = "1234567890"
+  call foo_str(my_str)
+  call bar_str(my_str)
+  my_str15 = "123456789012345"
+  call foobar (my_str15)
+  deallocate (A, my_str, my_str15)
+contains
+  subroutine foo (array, nn)
+    integer :: i, nn
+    integer :: array(nn)
+
+    !$acc parallel copyout(array)
+    array = [(-i, i = 1, nn)]
+    !$acc loop gang private(array)
+    do i = 1, 10
+      array(i) = i
+    end do
+    if (any (array /= [(-i, i = 1, nn)])) error stop 1
+    !$acc end parallel
+  end subroutine foo
+  subroutine bar (array)
+    integer :: i
+    integer :: array(:)
+
+    !$acc parallel copyout(array)
+    array = [(-2*i, i = 1, size(array))]
+    !$acc loop gang private(array)
+    do i = 1, 10
+      array(i) = 9*i
+    end do
+    if (any (array /= [(-2*i, i = 1, 10)])) error stop 2
+    !$acc end parallel
+  end subroutine bar
+  subroutine foo_str(str)
+    integer :: i
+    character(len=*) :: str
+
+    !$acc parallel copyout(str)
+    str = "abcdefghij"
+    !$acc loop gang private(str)
+    do i = 1, 10
+      str(i:i) = achar(ichar('A') + i)
+    end do
+    if (str /= "abcdefghij") error stop 3
+    !$acc end parallel
+  end
+  subroutine bar_str(str)
+    integer :: i
+    character(len=:), allocatable :: str
+
+! ***************************************
+! FIXME: Fails due to PR middle-end/95499
+! ***************************************
+    !!$acc parallel copyout(str)
+    str = "abcdefghij"
+    !!$acc loop gang private(str)
+    !do i = 1, 10
+    !  str(i:i) = achar(ichar('A') + i)
+    !end do
+    if (str /= "abcdefghij") error stop 5
+    !!$acc end parallel
+  end
+  subroutine foobar (scalar)
+    integer :: i
+    character(len=15), optional :: scalar
+
+    !$acc parallel copyout(scalar)
+    scalar = "abcdefghi-12345"
+    !$acc loop gang private(scalar)
+    do i = 1, 15
+      scalar(i:i) = achar(ichar('A') + i)
+    end do
+    !$acc end parallel
+    if (scalar /= "abcdefghi-12345") error stop 6
+  end subroutine foobar
+  subroutine foobar15 (scalar)
+    integer :: i
+    character(len=15), optional, allocatable :: scalar
+
+    !$acc parallel copyout(scalar)
+    scalar = "abcdefghi-12345"
+    !$acc loop gang private(scalar)
+    do i = 1, 15
+      scalar(i:i) = achar(ichar('A') + i)
+    end do
+    !$acc end parallel
+    if (scalar /= "abcdefghi-12345") error stop 1
+  end subroutine foobar15
+end
-- 
2.30.2

>From 5d42db533324e80a7382b20b94cace5b202d41ea Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <tho...@codesourcery.com>
Date: Fri, 21 May 2021 09:03:43 +0200
Subject: [PATCH 2/2] Don't skip 'libgomp.oacc-fortran/privatized-ref-2.f90'
 for nvptx offloading

	libgomp/
	* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Don't skip
	for nvptx offloading.
---
 .../libgomp.oacc-fortran/privatized-ref-2.f90        | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
index 6c3e1dcc211..907f0245f93 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -1,4 +1,11 @@
-! { dg-do run { target { ! openacc_nvidia_accel_selected } } }
+! { dg-do run }
+
+! PR65181 "Support for alloca in nvptx"
+! { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target openacc_nvidia_accel_selected } }
+! Aside from restricting this testcase to non-nvptx offloading, and duplicating
+! it with 'dg-do link' for nvptx offloading, there doesn't seem to be a way to
+! XFAIL the "UNRESOLVED: [...] compilation failed to produce executable", or
+! get rid of it, unfortunately.
 
 program main
   implicit none (type, external)
@@ -24,6 +31,7 @@ contains
     !$acc parallel copyout(array)
     array = [(-i, i = 1, nn)]
     !$acc loop gang private(array)
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
     do i = 1, 10
       array(i) = i
     end do
@@ -37,6 +45,7 @@ contains
     !$acc parallel copyout(array)
     array = [(-2*i, i = 1, size(array))]
     !$acc loop gang private(array)
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
     do i = 1, 10
       array(i) = 9*i
     end do
@@ -50,6 +59,7 @@ contains
     !$acc parallel copyout(str)
     str = "abcdefghij"
     !$acc loop gang private(str)
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
     do i = 1, 10
       str(i:i) = achar(ichar('A') + i)
     end do
-- 
2.30.2

Reply via email to