Skip to content

Commit 8298047

Browse files
authored
[NFC][OpenMP] Update a test that was failing on aarch64. (#164456)
The failure was reported here: #164039 (comment) The test was checking for the "bad" behavior so as to keep track of it, but there seem to be some issues with the pointer arithmetic specific to aarch64. The update for now is to not check for the "bad" behavior fully. We may need to debug further if similar issues are encountered eventually once the codegen has been fixed.
1 parent 57e976a commit 8298047

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

offload/test/mapping/use_device_addr/target_data_use_device_addr_class_member_ref_with_map.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct ST {
1616
int m = 0;
1717

1818
void f6() {
19-
uintptr_t offset = (uintptr_t)&d - n;
19+
ptrdiff_t offset = (char *)&d - ((char *)(uintptr_t)n);
2020
#pragma omp target data map(to : m, d)
2121
{
2222
void *mapped_ptr = omp_get_mapped_ptr(&d, omp_get_default_device());
@@ -34,11 +34,15 @@ struct ST {
3434
// ref/attach modifiers:
3535
// &ref_ptee(this[0].[d])), &ref_ptee(this[0].d), TO | FROM
3636
// &ref_ptr(this[0].d), &ref_ptee(this[0].d), 4, ATTACH
37-
// EXPECTED: 1 0
38-
// CHECK: 0 1
39-
printf("%d %d\n", &d == mapped_ptr,
40-
(uintptr_t)&d == (uintptr_t)mapped_ptr - offset);
37+
// EXPECTED: 1
38+
// CHECK-NEXT: 0
39+
printf("%d\n", &d == mapped_ptr);
40+
ptrdiff_t offset_device = (char *)mapped_ptr - (char *)&d;
41+
printf("offset = %td (%p), offset_device = %td (%p)\n", offset,
42+
(void *)offset, offset_device, (void *)offset_device);
43+
printf("mapped_ptr = %p, device_addr = %p, ", mapped_ptr, &d);
4144
}
45+
printf("host_addr = %p\n", &d);
4246
}
4347
}
4448
};

0 commit comments

Comments
 (0)