Paul, I've fixed the build but can not check how does valgrind work - it's broken on gentoo. There is fix procedure but it involves semi0manual rebuild of C library turning off some optimizations. I do not use valgrind for a long time (tools that were built into Jim's memory manager are enough for me).
Please check are there any more issues. If yes, send them to me, or close an item.