While this is apparently fixed upstream, the valgrind port in FreeBSD will fail when run with binaries built by gcc 4.6. The failure is:
Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x2a
While this says it's just a warning, the result is a failure with many subsequent errors such as:
valgrind: m_debuginfo/readdwarf.c:2338 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed.
==45514== at 0x3802B517: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd)
==45514== by 0x4050FDFDF: ???
==45514== by 0x3802CB26: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd)
==45514== by 0x3802B516: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd)
==45514== by 0x4050FDFDE: ???
Since this is fixed upstream, it is possible to backport the fix, as for example:
I am attaching a patch produced according to the scheme suggested in the link above. My patch file is a kitchen-sink patch, including all diffs needed to address the issue, not a collection of individual patch-file-name-X files as is customary in the ports system. But it works.
This will probably become unnecessary when the valgrind port is updated to a newer release, but it has been failing in this way for at least a couple of months (I first noticed it when gcc 4.5 was removed from ports and replaced by gcc 4.6).
Fix: Add the file attached to ports/devel/valgrind/files as "patch-valgrind-extra" and rebuild valgrind. It will no longer fail.
Patch attached with submission follows:
How-To-Repeat: Build gcc 4.6.x, compile a program with it. Install devel/valgrind, run valgrind over the program you built. It will die.