[llvm-bugs] [Bug 48184] New: use_device_addr always returns a NULL pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 14 18:44:20 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48184

            Bug ID: 48184
           Summary: use_device_addr always returns a NULL pointer
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: csdaley at lbl.gov
                CC: llvm-bugs at lists.llvm.org

The use_device_addr clause appears to be implemented incorrectly
(use_device_ptr clause works as expected). The LLVM OpenMP trace shows
use_device_addr returns a NULL pointer `Libomptarget --> Returning device
pointer 0x0000000000000000` before the test program segfaults on the fprintf
statement.

```
#include <stdio.h>
#include <stdlib.h>
#define N 100
int main()
{
  double *x = malloc(N*sizeof(double));
#pragma omp target enter data map(alloc:x[:N])

#pragma omp target data use_device_ptr(x)
  {
    fprintf(stderr, "ptr=%p\n", (void*)x);
  }
#pragma omp target data use_device_addr(x)
  {
    fprintf(stderr, "addr=%p\n", (void*)x); // Fail
  }
  return 0;
}
```

I tested with Clang/LLVM commit bae9aedb341c5f4eceafba2ee1fec7c05d842c97 (12
Nov 2020)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201115/e378eafc/attachment.html>


More information about the llvm-bugs mailing list