Bug 11788 – [x86] Valgrind unhandled instruction bytes: 0xC8 0x8 0x0 0x0

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2013-12-21T06:33:00Z
Last change time
2014-06-06T01:57:24Z
Keywords
pull
Assigned to
yebblies
Creator
bruno.deligny

Comments

Comment #0 by bruno.deligny — 2013-12-21T06:33:22Z
I have this error with valgrind with an very simple 32 bits exe generated with dmd. import std.stdio; int main() { writeln("Hello world"); return 0; } dmd -g main.d ==7091== Memcheck, a memory error detector ==7091== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==7091== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==7091== Command: ./main ==7091== vex x86->IR: unhandled instruction bytes: 0xC8 0x8 0x0 0x0 ==7091== valgrind: Unrecognised instruction at address 0x8069b54. ==7091== at 0x8069B54: ??? (in /home/bruno/main) ==7091== Your program just tried to execute an instruction that Valgrind ==7091== did not recognise. There are two possible reasons for this. ==7091== 1. Your program has a bug and erroneously jumped to a non-code ==7091== location. If you are running Memcheck and you just saw a ==7091== warning about a bad jump, it's probably your program's fault. ==7091== 2. The instruction is legitimate but Valgrind doesn't handle it, ==7091== i.e. it's Valgrind's fault. If you think this is the case or ==7091== you are not sure, please let us know and we'll try to fix it. ==7091== Either way, Valgrind will now raise a SIGILL signal which will ==7091== probably kill your program. ==7091== ==7091== Process terminating with default action of signal 4 (SIGILL) ==7091== Illegal opcode at address 0x8069B54 ==7091== at 0x8069B54: ??? (in /home/bruno/main) ==7091== ==7091== HEAP SUMMARY: ==7091== in use at exit: 0 bytes in 0 blocks ==7091== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==7091== ==7091== All heap blocks were freed -- no leaks are possible ==7091== ==7091== For counts of detected and suppressed errors, rerun with: -v ==7091== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Instruction non permise
Comment #1 by maxim — 2013-12-21T06:40:16Z
This belongs to valgrind bugzilla.
Comment #2 by bruno.deligny — 2013-12-21T09:19:48Z
I know but it's already reported on valgrind bugtracker since a while: https://bugs.kde.org/show_bug.cgi?id=272971 https://bugs.kde.org/show_bug.cgi?id=253433 https://bugs.kde.org/show_bug.cgi?id=317208 I tried with last Valgrind release and with Valgrind svn code. Nobody seams to care because nobody uses this instruction (enter). From Intel's Optimisation Reference Manual: "Assembler/Compiler Coding Rule 40. (ML impact, M generality) Avoid using complex instructions (for example, enter, leave, or loop) that have more than 4 uops and require multiple cycles to decode. Use sequences of simple instructions instead. Complex instructions may save architectural registers, but incur a penalty of 4 uops to set up parameters for the microcode ROM." Maybe it would be wise for dmd to be more "standard" (do like gcc or llvm) because good tool support is extremely important and Valgrind is a leader in that domain.
Comment #3 by maxim — 2013-12-21T10:49:34Z
I see. But AFAIK Walter is reluctant to change it. This is enhancement request at best.
Comment #4 by yebblies — 2013-12-21T20:52:31Z
IMO the optimization manual quote seals it. I'll put it on my to-do list.
Comment #5 by yebblies — 2014-06-01T11:21:53Z
Comment #6 by github-bugzilla — 2014-06-06T01:57:23Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ecbff2da4668e78304138131ef15f00bac00ab00 Fix Issue 11788 - [x86] Valgrind unhandled instruction bytes: 0xC8 0x8 0x0 0x0 Use combination of PUSH, MOV and SUB instead of unsupported ENTER instruction https://github.com/D-Programming-Language/dmd/commit/2115e0c3f2ef3a20af1cd244e1195418514a1020 Merge pull request #3609 from yebblies/issue11788 Issue 11788 - [x86] Valgrind unhandled instruction bytes: 0xC8 0x8 0x0 0x0