Bug 338393 - vex amd64->IR: unhandled instruction bytes: 0x6E 0xD8 0x48 0x89 0xE5 0x41 0x55 0xC4
Summary: vex amd64->IR: unhandled instruction bytes: 0x6E 0xD8 0x48 0x89 0xE5 0x41 0x5...
Status: RESOLVED WAITINGFORINFO
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.9.0
Platform: unspecified Unspecified
: NOR crash
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-20 03:41 UTC by Neo1989
Modified: 2022-09-26 08:37 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Neo1989 2014-08-20 03:41:38 UTC
I'm trying to run my program which uses AVX/AVX2 instructions explicitly. However Valgrind reports the following unhandled instruction error with optimization -O2.

More interestingly, my program runs smoothly with no error in Valgrind when compiled with -O0. It also runs smoothly in GDB with all optimization levels. However, with -O1 and -O3, Valgrind reports another invalid write error, which also looks confusing for me. Due to this complicated outputs, I hesitate whether I should blame myself or Valgrind. 

==23932== Memcheck, a memory error detector
==23932== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==23932== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==23932== Command: ./experiments/simple -s 1048576
==23932== 
ColumnType= ByteSlicePadRight num_rows= 1048576 code_length= 16 selectivity= 0.1 repeat= 1
vex amd64->IR: unhandled instruction bytes: 0x6E 0xD8 0x48 0x89 0xE5 0x41 0x55 0xC4
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==23932== valgrind: Unrecognised instruction at address 0x42f03b.
==23932==    at 0x42F03B: void byteslice::ByteSliceColumnBlock<16ul, (byteslice::Direction)1>::ScanHelper2<(byteslice::Comparator)2, (byteslice::Bitwise)0>(unsigned long, byteslice::BitVectorBlock*) const (avxintrin.h:1262)
==23932==    by 0x1: ???
==23932==    by 0x447B8D: byteslice::Column::Scan(byteslice::Comparator, unsigned long, byteslice::BitVector*, byteslice::Bitwise) const (column.cpp:113)
==23932== Your program just tried to execute an instruction that Valgrind
==23932== did not recognise.  There are two possible reasons for this.
==23932== 1. Your program has a bug and erroneously jumped to a non-code
==23932==    location.  If you are running Memcheck and you just saw a
==23932==    warning about a bad jump, it's probably your program's fault.
==23932== 2. The instruction is legitimate but Valgrind doesn't handle it,
==23932==    i.e. it's Valgrind's fault.  If you think this is the case or
==23932==    you are not sure, please let us know and we'll try to fix it.
==23932== Either way, Valgrind will now raise a SIGILL signal which will
==23932== probably kill your program.
==23932== 
==23932== Process terminating with default action of signal 4 (SIGILL)
==23932==  Illegal opcode at address 0x42F03B
==23932==    at 0x42F03B: void byteslice::ByteSliceColumnBlock<16ul, (byteslice::Direction)1>::ScanHelper2<(byteslice::Comparator)2, (byteslice::Bitwise)0>(unsigned long, byteslice::BitVectorBlock*) const (avxintrin.h:1262)
==23932==    by 0x1: ???
==23932==    by 0x447B8D: byteslice::Column::Scan(byteslice::Comparator, unsigned long, byteslice::BitVector*, byteslice::Bitwise) const (column.cpp:113)
==23932== 
==23932== HEAP SUMMARY:
==23932==     in use at exit: 2,228,408 bytes in 9 blocks
==23932==   total heap usage: 9 allocs, 0 frees, 2,228,408 bytes allocated
==23932== 
==23932== LEAK SUMMARY:
==23932==    definitely lost: 0 bytes in 0 blocks
==23932==    indirectly lost: 0 bytes in 0 blocks
==23932==      possibly lost: 0 bytes in 0 blocks
==23932==    still reachable: 2,228,408 bytes in 9 blocks
==23932==         suppressed: 0 bytes in 0 blocks
==23932== Rerun with --leak-check=full to see details of leaked memory
==23932== 
==23932== For counts of detected and suppressed errors, rerun with: -v
==23932== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction (core dumped)

My program is single-threaded.
I compile with g++-4.9 -std=c++11 -mavx2 -m64 -ggdb -O0~-O3
My kernel is 3.13.0-34-generic
Valgrind version: valgrind-3.10.0.SVN
Comment 1 Paul Floyd 2022-09-26 08:37:13 UTC
3.10 is very old. There's no reproducer attachment. I don't see how we can fix this.