]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp.fortran/metadirective-1.f90: Expect 'error:' for nvptx compile [PR118694]
authorTobias Burnus <tburnus@baylibre.com>
Wed, 28 May 2025 13:14:14 +0000 (15:14 +0200)
committerTobias Burnus <tburnus@baylibre.com>
Wed, 28 May 2025 13:14:14 +0000 (15:14 +0200)
This should have been part of commit r16-838-gb3d07ec7ac2ccd or
r16-883-g5d6ed6d604ff94 - all showing the same issue:
'!$omp target' followed by a metadirective with 'teams'; if
the metadirective cannot be early resolved, a diagnostic
error is shown about using directives between 'target' and
'teams'.

While the message is misleading, the problem is that the
host invokes 'target' differently when 'teams' is present;
in this case, host fallback + amdgcn offload require the
no-teams case, nvptx offload the teams case such that it
only can be resolved at runtime.

Mark the error as 'dg-bogus + xfail' to silence the FAIL,
when nvptx offloading is compiled for. (If not, the
metadirective can be resolved early during compilation.)

libgomp/ChangeLog:

PR middle-end/118694
* testsuite/libgomp.fortran/metadirective-1.f90: xfail when
compiling (also) for nvptx offloading as an error is then expected.

libgomp/testsuite/libgomp.fortran/metadirective-1.f90

index 7b3e09f7c2a5016f2432be86332c07e2055b4b7c..d6f4d5bbde69e6d12ff567c10b9f8b42ee75d9e5 100644 (file)
@@ -1,4 +1,5 @@
-! { dg-do run }
+! { dg-do run { target { ! offload_target_nvptx } } }
+! { dg-do compile { target offload_target_nvptx } }
 
 program test
   implicit none
@@ -33,6 +34,10 @@ program test
 contains
   subroutine f (x, y, z)
     integer :: x(N), y(N), z(N)
+    ! The following fails as on the host the target side cannot be
+    ! resolved - and the 'teams' or not status affects how 'target'
+    ! is called. -> See PR118694, esp. comment 9.
+    ! Note also the dg-do compile above for offload_target_nvptx
 
     !$omp target map (to: x, y) map(from: z)
       block
@@ -43,6 +48,7 @@ contains
          z(i) = x(i) * y(i)
        enddo
       end block
+    ! { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-9 }  */
   end subroutine
   subroutine g (x, y, z)
     integer :: x(N), y(N), z(N)
@@ -56,6 +62,7 @@ contains
          z(i) = x(i) * y(i)
        enddo
     end block
+    ! { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-9 }  */
     !$omp end target
   end subroutine
 end program