[llvm] [NFC][OpenMP] Update a test that was failing on aarch64. (PR #164456)

Abhinav Gaba via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 21 09:32:39 PDT 2025


https://github.com/abhinavgaba created https://github.com/llvm/llvm-project/pull/164456

The failure was reported here:

https://github.com/llvm/llvm-project/pull/164039#issuecomment-3425429556

The test is checking for the "bad" behavior so as to keep track of it. It could just be updated to check the "good" behavior and marked as XFAIL, but then it would not be as informative.

The update for now is to fix the pointer arithmetic. If that isn't sufficient, we can fall back to doing the above.

>From 41da687c9add317db49a2d69625d33536392cd2f Mon Sep 17 00:00:00 2001
From: Abhinav Gaba <abhinav.gaba at intel.com>
Date: Tue, 21 Oct 2025 09:26:36 -0700
Subject: [PATCH] [NFC][OpenMP] Update a test that was failing on aarch64.

The failure was reported here:

https://github.com/llvm/llvm-project/pull/164039#issuecomment-3425429556

The test is checking for the "bad" behavior so as to keep track of it.
It could just be updated to check the "good" behavior and marked as
XFAIL, but then it would not be as informative.

The update for now is to fix the pointer arithmetic. If that isn't
sufficient, we can fall back to doing the above.
---
 ...data_use_device_addr_class_member_ref_with_map.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/offload/test/mapping/use_device_addr/target_data_use_device_addr_class_member_ref_with_map.cpp b/offload/test/mapping/use_device_addr/target_data_use_device_addr_class_member_ref_with_map.cpp
index 5e8769eb3079d..204e1c3407724 100644
--- a/offload/test/mapping/use_device_addr/target_data_use_device_addr_class_member_ref_with_map.cpp
+++ b/offload/test/mapping/use_device_addr/target_data_use_device_addr_class_member_ref_with_map.cpp
@@ -16,7 +16,7 @@ struct ST {
   int m = 0;
 
   void f6() {
-    uintptr_t offset = (uintptr_t)&d - n;
+    intptr_t offset = (uintptr_t)&d - n;
 #pragma omp target data map(to : m, d)
     {
       void *mapped_ptr = omp_get_mapped_ptr(&d, omp_get_default_device());
@@ -34,10 +34,11 @@ struct ST {
         // ref/attach modifiers:
         //  &ref_ptee(this[0].[d])), &ref_ptee(this[0].d), TO | FROM
         //  &ref_ptr(this[0].d), &ref_ptee(this[0].d), 4, ATTACH
-        // EXPECTED: 1 0
-        // CHECK:    0 1
-        printf("%d %d\n", &d == mapped_ptr,
-               (uintptr_t)&d == (uintptr_t)mapped_ptr - offset);
+        // EXPECTED:   1 0
+        // CHECK-NEXT: 0 1
+        intptr_t offset_device = (intptr_t)mapped_ptr - (intptr_t)&d;
+        printf("%d %d\n", &d == mapped_ptr, offset == offset_device);
+        printf("%lu %ld\n", offset, offset_device);
       }
     }
   }



More information about the llvm-commits mailing list