Source based distros and valgrind

Christian Kruse,

This weekend I changed my Linux notebook back to Gentoo. After getting back to work a weird error occured when working with Valgrind on a self written C++ program: when running a program with valgrind, I get the following message and the program terminates:

vex amd64->IR: unhandled instruction bytes: 0xC5 0xFB 0x10 0x44 0x24 0xF8 0xC3
==7616== valgrind: Unrecognised instruction at address 0x795bf13.
==7616==    at 0x795BF13: __mpn_construct_double (mpn2dbl.c:41)
==7616==    by 0x795449A: ____strtod_l_internal (strtod_l.c:1566)
==7616==    by 0x5075C5F: CForum::JSON::Parser::getNextToken(char const*, char const*, CForum::JSON::Parser::Token&) (
==7616==    by 0x50762D5: CForum::JSON::Parser::readValue(boost::shared_ptr*, char const*, char const*) (
==7616==    by 0x50760AC: CForum::JSON::Parser::readObject(boost::shared_ptr, char const*, char const*) (
==7616==    by 0x5076386: CForum::JSON::Parser::readValue(boost::shared_ptr*, char const*, char const*) (
==7616==    by 0x4E491E6: CForum::JSON::Parser::parse(char const*, unsigned long, boost::shared_ptr&) (json_parser.hh:140)
==7616==    by 0x4E490CA: CForum::JSON::Parser::parse(char const*, boost::shared_ptr&) (json_parser.hh:136)
==7616==    by 0x4E45E00: JSONTest::testParser() (

// [… snip …]

After creating a bug report, I found out that this is because valgrind does not yet handle the AVX instruction set, a CPU instruction set to handle vector data more efficient. This instructions are generated by GCC with -march=native set. Since I use this compiler flag on every source based distribution I use, this is a serious problem.

To avoid this problem, you have to specify -march=nocona, as described in the meta bug report for AVX support.