Bug 12873 – Valgrind unhandled instruction bytes 0x48 0xDB (redundant REX_W prefix on x87 load)

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2014-06-06T23:43:00Z
Last change time
2015-06-09T05:11:40Z
Keywords
pull, wrong-code
Assigned to
yebblies
Creator
yebblies

Comments

Comment #0 by yebblies — 2014-06-06T23:43:03Z
This code, compiled with 2.066 master, fails to run under valgrind module complex; struct complex_t { real re = 0; real im = 0; int opEquals(complex_t y) { return re == y.re && im == y.im; } }; void main() { auto x = complex_t(0); assert(x == x); } Gives (among other messages) vex amd64->IR: unhandled instruction bytes: 0x48 0xDB 0x6B 0x70 0x48 0x83 This is a bug in valgrind, where it doesn't accept the redundant 0x48 (REX_W) prefix on the fld instruction. We can work around this by not emitting the REX_W prefix on this instruction.
Comment #1 by yebblies — 2014-06-07T00:25:46Z
Comment #2 by github-bugzilla — 2014-06-07T06:58:02Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5d79f23865ef39217c0e5069fbc3aae659d74af4 Fix Issue 12873 - Valgrind unhandled instruction bytes 0x48 0xDB (redundant REX_W prefix on x87 load) https://github.com/D-Programming-Language/dmd/commit/a44b7b8bc3ff041eb9e524adc242d64672a0c42c Merge pull request #3634 from yebblies/issue12873 Issue 12873 - Valgrind unhandled instruction bytes 0x48 0xDB (redundant REX_W prefix on x87 load)
Comment #3 by github-bugzilla — 2014-06-07T06:59:49Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/52b86663bea548004ae13317fb18416f26b234fa Fix Issue 12873 - Valgrind unhandled instruction bytes 0x48 0xDB (redundant REX_W prefix on x87 load)
Comment #4 by yebblies — 2014-06-07T07:37:29Z
Is this really wrong-code? I'd say it's just a workaround for a valgrind bug, and a minor code-size optimization.