[OpenMP][test]Flip bit-fields in 'struct flags' for big-endian in test cases (#79895)
This patch flips bit-fields in `struct flags` for big-endian in test
cases to be consistent with the definition of the structure in libomp
`kmp.h`.
GitOrigin-RevId: 7a9b0e4acb3b5ee15f8eb138aad937cfa4763fb8
diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h
index c287a31..b147063 100644
--- a/runtime/src/kmp.h
+++ b/runtime/src/kmp.h
@@ -2494,7 +2494,8 @@
#define KMP_DEP_MTX 0x4
#define KMP_DEP_SET 0x8
#define KMP_DEP_ALL 0x80
-// Compiler sends us this info:
+// Compiler sends us this info. Note: some test cases contain an explicit copy
+// of this struct and should be in sync with any changes here.
typedef struct kmp_depend_info {
kmp_intptr_t base_addr;
size_t len;
diff --git a/runtime/test/tasking/bug_nested_proxy_task.c b/runtime/test/tasking/bug_nested_proxy_task.c
index 43502bd..24fe1f3 100644
--- a/runtime/test/tasking/bug_nested_proxy_task.c
+++ b/runtime/test/tasking/bug_nested_proxy_task.c
@@ -50,12 +50,21 @@
union {
kmp_uint8 flag; // flag as an unsigned char
struct { // flag as a set of 8 bits
- unsigned in : 1;
- unsigned out : 1;
- unsigned mtx : 1;
- unsigned set : 1;
- unsigned unused : 3;
- unsigned all : 1;
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ unsigned all : 1;
+ unsigned unused : 3;
+ unsigned set : 1;
+ unsigned mtx : 1;
+ unsigned out : 1;
+ unsigned in : 1;
+#else
+ unsigned in : 1;
+ unsigned out : 1;
+ unsigned mtx : 1;
+ unsigned set : 1;
+ unsigned unused : 3;
+ unsigned all : 1;
+#endif
} flags;
};
} kmp_depend_info_t;
diff --git a/runtime/test/tasking/bug_proxy_task_dep_waiting.c b/runtime/test/tasking/bug_proxy_task_dep_waiting.c
index ff75df5..688860c 100644
--- a/runtime/test/tasking/bug_proxy_task_dep_waiting.c
+++ b/runtime/test/tasking/bug_proxy_task_dep_waiting.c
@@ -47,12 +47,21 @@
union {
kmp_uint8 flag; // flag as an unsigned char
struct { // flag as a set of 8 bits
- unsigned in : 1;
- unsigned out : 1;
- unsigned mtx : 1;
- unsigned set : 1;
- unsigned unused : 3;
- unsigned all : 1;
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ unsigned all : 1;
+ unsigned unused : 3;
+ unsigned set : 1;
+ unsigned mtx : 1;
+ unsigned out : 1;
+ unsigned in : 1;
+#else
+ unsigned in : 1;
+ unsigned out : 1;
+ unsigned mtx : 1;
+ unsigned set : 1;
+ unsigned unused : 3;
+ unsigned all : 1;
+#endif
} flags;
};
} kmp_depend_info_t;
diff --git a/runtime/test/tasking/hidden_helper_task/common.h b/runtime/test/tasking/hidden_helper_task/common.h
index 402ecf3..ba57656 100644
--- a/runtime/test/tasking/hidden_helper_task/common.h
+++ b/runtime/test/tasking/hidden_helper_task/common.h
@@ -17,9 +17,21 @@
union {
unsigned char flag;
struct {
- bool in : 1;
- bool out : 1;
- bool mtx : 1;
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ unsigned all : 1;
+ unsigned unused : 3;
+ unsigned set : 1;
+ unsigned mtx : 1;
+ unsigned out : 1;
+ unsigned in : 1;
+#else
+ unsigned in : 1;
+ unsigned out : 1;
+ unsigned mtx : 1;
+ unsigned set : 1;
+ unsigned unused : 3;
+ unsigned all : 1;
+#endif
} flags;
};
} kmp_depend_info_t;