Skip to content

Commit 914ebac

Browse files
committed
Use ptrdiff
1 parent 03aec33 commit 914ebac

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

offload/test/mapping/use_device_addr/target_data_use_device_addr_class_member_ref_with_map.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %libomptarget-compilexx-run-and-check-generic
22

3-
#include <inttypes.h>
43
#include <omp.h>
54
#include <stdio.h>
65

@@ -17,7 +16,7 @@ struct ST {
1716
int m = 0;
1817

1918
void f6() {
20-
intptr_t offset = (uintptr_t)&d - n;
19+
ptrdiff_t offset = (char *)&d - ((char *)(uintptr_t)n);
2120
#pragma omp target data map(to : m, d)
2221
{
2322
void *mapped_ptr = omp_get_mapped_ptr(&d, omp_get_default_device());
@@ -37,9 +36,10 @@ struct ST {
3736
// &ref_ptr(this[0].d), &ref_ptee(this[0].d), 4, ATTACH
3837
// EXPECTED: 1 0
3938
// CHECK-NEXT: 0 1
40-
intptr_t offset_device = (intptr_t)mapped_ptr - (intptr_t)&d;
39+
ptrdiff_t offset_device = (char *)mapped_ptr - (char *)&d;
4140
printf("%d %d\n", &d == mapped_ptr, offset == offset_device);
42-
printf("%" PRIdPTR " %" PRIdPTR "\n", offset, offset_device);
41+
printf("%td (%p) %td (%p)\n", offset, (void *)offset, offset_device,
42+
(void *)offset_device);
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)