When i use valgrind on a very simple hdf5 application:
#include <stdio.h>
#include <hdf5.h>
int main() {
const char sFileName[] = "test1.qdf";
hid_t hFile = H5Fcreate(sFileName, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if (hFile > 0) {
printf("File %s opened\n", sFileName);
H5Fclose(hFile);
} else {
printf("Couldn't create hFile [%s]\n", sFileName);
}
return 0;
}
i get these messages:
vex amd64->IR: unhandled instruction bytes: 0x62 0xF1 0xFE 0x8 0x6F 0x45 0x0 0xC5 0xF8 0x11
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
==34559== valgrind: Unrecognised instruction at address 0x4a50820.
==34559== at 0x4A50820: H5P_dup_prop (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A52465: H5P__do_prop_cb1.part.13 (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A51C01: H5P_create_id (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A52155: H5P__init_package (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A522C7: H5P_init (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x48C60ED: H5_init_library (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x48C690F: H5open (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x109213: main (h5simple.cpp:6)
==34559== Your program just tried to execute an instruction that Valgrind
==34559== did not recognise. There are two possible reasons for this.
==34559== 1. Your program has a bug and erroneously jumped to a non-code
==34559== location. If you are running Memcheck and you just saw a
==34559== warning about a bad jump, it's probably your program's fault.
==34559== 2. The instruction is legitimate but Valgrind doesn't handle it,
==34559== i.e. it's Valgrind's fault. If you think this is the case or
==34559== you are not sure, please let us know and we'll try to fix it.
==34559== Either way, Valgrind will now raise a SIGILL signal which will
==34559== probably kill your program.
==34559==
==34559== Process terminating with default action of signal 4 (SIGILL)
==34559== Illegal opcode at address 0x4A50820
==34559== at 0x4A50820: H5P_dup_prop (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A52465: H5P__do_prop_cb1.part.13 (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A51C01: H5P_create_id (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A52155: H5P__init_package (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x4A522C7: H5P_init (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x48C60ED: H5_init_library (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x48C690F: H5open (in /usr/lib64/libhdf5.so.103.1.0)
==34559== by 0x109213: main (h5simple.cpp:6)
By itself (i.e. no valgrind) the program runs without errors.
I tried the valgrind versions 3.13.0, 3.14.0 and 3.15.0, and the gcc versions 6.4.0, 7.4.0, 8.3.0 and 9.2.0. For all combinations of these valgrind versions and gcc versions valgrind gives the "illegal opcode" message.
The HDF5 i am using has version 1.10.5 (on gentoo). On my system i seem not to be able to install older versions of HDF5.
Is this illegal opcode a bug of HDF5? What steps do i have to take to be able to use valgrind on my HDF5 application?