Created attachment 118631 [details] cast patch to fix Clang failure SUMMARY Clang/LLVM fails an assertion when compiling my_offsetof in VEX/auxprogs/genoffsets.c. STEPS TO REPRODUCE 1. Build Valgrind with Clang (tested on FreeBSD with Clang 8.0) OBSERVED RESULT Clang assertion failure: Assertion failed: (EVResult.Val.isInt() && "Expression did not evaluate to integer"), function EvaluateKnownConstInt, file /home/dim/src/llvm/trunk/tools/clang/lib/AST/ExprConstant.cpp, line 11056. EXPECTED RESULT Valgrind builds The assertion failure is a Clang bug, but the fix is probably to emit a diagnostic message instead. Details in https://bugs.llvm.org/show_bug.cgi?id=40890. Attached patch copies cast from the other my_offsetof definition (from none/tests/x86/x87trigOOR.c). SOFTWARE/OS VERSIONS FreeBSD 12.0 ADDITIONAL INFORMATION
This has been patched in Clang upstream and in FreeBSD's copy (https://svnweb.freebsd.org/changeset/base/344896), but having two different my_offsetof macros is still worth cleaning up.
Pushed as 4816357b5c7ee5284cdf72800a81d2dd1845388f. Thanks for the patch and diagnosis.