This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgomp/81805] Another libgomp.c/for-5.c failure on nvptx -- illegal memory access


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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Simplified version, aborts in host code because loop has no effect:
...
#include <stdio.h>

extern void abort ();

#define N 32ULL

#pragma omp declare target
int a[N];
#pragma omp end declare target

const unsigned long long c = 0x7fffffffffffffffULL;

__attribute__((noinline, noclone)) void
f2_tpf_static32 (void)
{
  unsigned long long i;
#pragma omp target parallel for schedule(static, 32)
  for (i = c + N; i > c; i -= 1ULL)
    a[i - 1ULL - c] -= 4;
}

__attribute__((noinline, noclone)) int
test_tpf_static32 (void)
{
  int i, j, k;
  for (i = 0; i < N; i++)
    a[i] = i - 25;

#pragma omp target update to(a)
  f2_tpf_static32 ();
#pragma omp target update from(a)

  for (i = 0; i < N; i++)
    printf ("%d: %d, expected: %d\n", i, a[i], i - 29);

  for (i = 0; i < N; i++)
    if (a[i] != i - 29)
      return 1;

  return 0;
}

int
main ()
{
  if (test_tpf_static32 ())
    abort ();

  return 0;
}
...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]