[Openmp-commits] [openmp] b1d5748 - [Libomptarget] Allow static assert to work on 32-bit systems

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Tue Jul 12 05:05:12 PDT 2022


Author: Joseph Huber
Date: 2022-07-12T08:05:01-04:00
New Revision: b1d574867defe980312e63f6590cebbac953ca34

URL: https://github.com/llvm/llvm-project/commit/b1d574867defe980312e63f6590cebbac953ca34
DIFF: https://github.com/llvm/llvm-project/commit/b1d574867defe980312e63f6590cebbac953ca34.diff

LOG: [Libomptarget] Allow static assert to work on 32-bit systems

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

Added: 
    

Modified: 
    openmp/libomptarget/include/omptarget.h

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/include/omptarget.h b/openmp/libomptarget/include/omptarget.h
index 381fb4078e3c6..935a815702463 100644
--- a/openmp/libomptarget/include/omptarget.h
+++ b/openmp/libomptarget/include/omptarget.h
@@ -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


        


More information about the Openmp-commits mailing list