Bug 405182 - Valgrind fails to build with Clang
Summary: Valgrind fails to build with Clang
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other FreeBSD
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-07 16:30 UTC by Ed Maste
Modified: 2019-03-12 17:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
cast patch to fix Clang failure (1.19 KB, patch)
2019-03-07 16:30 UTC, Ed Maste
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste 2019-03-07 16:30:54 UTC
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
Comment 1 Ed Maste 2019-03-07 20:15:35 UTC
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.
Comment 2 Julian Seward 2019-03-12 17:40:35 UTC
Pushed as 4816357b5c7ee5284cdf72800a81d2dd1845388f.  Thanks
for the patch and diagnosis.