John Reiser: On x86, the byte sequence {0xc7,0310,1,2,3,4} superficially looks like "move immediate to r/m dword" because of the opcode 0xC7. Actually, it is an illegal instruction because 0!=(070 & mod_rm); namely, the 0310 should be 0300. Gdb disassembly should report illegal instruction, but instead says "movl $0x4030201,%eax".
Please see the original post: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=172034 Steps to Reproduce: 1. Compile and run this program under gdb: -----foo.S _start: .globl _start nop; int3 .byte 0xc7,0310,1,2,3,4 nop; nop ----- $ gcc -o foo -nostartfiles -nostdlib foo.S $ gdb foo (gdb) run 2. 3. Actual Results: Program received signal SIGTRAP, Trace/breakpoint trap. ## as expected for 'int3' 0x08048076 in _start () (gdb) x/i $pc 0x8048076 <_start+2>: mov $0x4030201,%eax ## gdb says it's OK (gdb) stepi Program received signal SIGILL, Illegal instruction. ## CPU rejects 0x08048076 in _start () 0x8048076 <_start+2>: mov $0x4030201,%eax (gdb) Expected Results: Program received signal SIGTRAP, Trace/breakpoint trap. 0x08048076 in _start () (gdb) x/i $pc 0x8048076 <_start+2>: (bad) ## modrm of 0310 is illegal for opcode 0xC7 -- Summary: bad disassembly for 0xC7 /1 "movl $___," Product: binutils Version: 2.18 (HEAD) Status: NEW Severity: minor Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: web-sources dot redhat dot com at jankratochvil dot net CC: bug-binutils at gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=2829 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils