]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VEX/auxprogs/genoffsets.c: Add cast to my_offsetof. n-i-bz.
authorJulian Seward <jseward@acm.org>
Tue, 12 Mar 2019 17:37:15 +0000 (18:37 +0100)
committerJulian Seward <jseward@acm.org>
Tue, 12 Mar 2019 17:37:15 +0000 (18:37 +0100)
Clang/LLVM trips over my_offsetof in VEX/auxprogs/genoffsets.c.  See LLVM
PR 40890 for details (https://bugs.llvm.org/show_bug.cgi?id=40890).

Now, it's a Clang bug that Clang exits on an assertion failure rather than
emits a diagnostic, but the previous my_offsetof expression is a pointer,
not an integer.  Add a cast as done in other definitions of offsetof in
the tree.  Patch from Ed Maste <emaste@freebsd.org>.

VEX/auxprogs/genoffsets.c

index 1f680e4f6cbe51fb9a71af3a9e291699794a40da..aa326b35ef7b65ad218acbd4290cfb48257a80b6 100644 (file)
@@ -59,7 +59,8 @@
 #define VG_STRINGIFZ(__str)  #__str
 #define VG_STRINGIFY(__str)  VG_STRINGIFZ(__str)
 
-#define my_offsetof(__type,__field) (&((__type*)0)->__field)
+#define my_offsetof(__type,__field) \
+           ((unsigned long int)(&((__type*)0)->__field))
 
 /* This forces gcc to evaluate the my_offsetof call at compile time,
    and then emits it in the assembly, along with the nonsense string