[Libomptarget] Allow static assert to work on 32-bit systems
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 12 Jul 2022 12:02:17 +0000 (08:02 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 12 Jul 2022 12:05:01 +0000 (08:05 -0400)
Summary:
We use a static assert to make sure that someone doesn't change the size
of an argument struct without properly updating all the other logic.
This originally only checked the size on a 64-bit system with 8-byte
pointers, causing builds on 32-bit systems to fail. This patch allows
either pointer size to work.

Fixes #56486

openmp/libomptarget/include/omptarget.h

index 381fb40..935a815 100644 (file)
@@ -121,7 +121,9 @@ struct __tgt_kernel_arguments {
   void **ArgMappers;  // User-defined mappers, possibly null.
   int64_t Tripcount;  // Tripcount for the teams / distribute loop, 0 otherwise.
 };
-static_assert(sizeof(__tgt_kernel_arguments) == 64, "Invalid struct size");
+static_assert(sizeof(__tgt_kernel_arguments) == 64 ||
+                  sizeof(__tgt_kernel_arguments) == 40,
+              "Invalid struct size");
 
 /// This struct is a record of an entry point or global. For a function
 /// entry point the size is expected to be zero