|
From: Julian S. <se...@so...> - 2019-03-12 17:39:39
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4816357b5c7ee5284cdf72800a81d2dd1845388f commit 4816357b5c7ee5284cdf72800a81d2dd1845388f Author: Julian Seward <js...@ac...> Date: Tue Mar 12 18:37:15 2019 +0100 VEX/auxprogs/genoffsets.c: Add cast to my_offsetof. n-i-bz. 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 <em...@fr...>. Diff: --- VEX/auxprogs/genoffsets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VEX/auxprogs/genoffsets.c b/VEX/auxprogs/genoffsets.c index 1f680e4..aa326b3 100644 --- a/VEX/auxprogs/genoffsets.c +++ b/VEX/auxprogs/genoffsets.c @@ -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 |