https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104913

            Bug ID: 104913
           Summary: [OpenMP] Bogus 'unused variable' with 'omp depobj'
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic, openmp
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The following C code shows the warning

foo.c:6:7: warning: unused variable ‘x’ [-Wunused-variable]
    6 |   int x;
      |       ^

but the variable is used in 'depend(inout: x)'.

(No warning for the Fortran code, which is fine. Found when looking at
https://github.com/SOLLVE/sollve_vv/pull/493 which then uses obj with
omp_target_memcpy_async.)


-----------------------
#include <omp.h>

void
foo ()
{
  int x;
  omp_depend_t obj;
  #pragma omp depobj(obj) depend(inout: x)
}
-----------------------
subroutine foo
  use omp_lib
  implicit none
  integer :: x
  integer(omp_depend_kind) obj
  !$omp depobj(obj) depend(inout: x)
end

Reply via email to