[PATCH] Support running the selftests under valgrind

Jeff Law law@redhat.com
Mon Jul 11 14:14:00 GMT 2016


On 07/08/2016 01:46 PM, David Malcolm wrote:
> This patch adds a new phony target to gcc/Makefile.in to make it easy
> to run the selftests under valgrind, via "make selftest-valgrind".
> This phony target isn't a dependency of anything; it's purely for
> convenience (it takes about 4-5 seconds on my box).
>
> Doing so uncovered a few leaks in the selftest suite, which the
> patch also fixes, so that it runs cleanly under valgrind (on
> x86_64-pc-linux-gnu, configured with --enable-valgrind-annotations,
> at least).
>
> Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu.
> Manually verified that the valgrind output is "clean" on
> x86_64-pc-linux-gnu [1].
>
> OK for trunk?
>
> [1]:
>
>  HEAP SUMMARY:
>      in use at exit: 1,203,983 bytes in 2,114 blocks
>    total heap usage: 4,545 allocs, 2,431 frees, 3,212,841 bytes allocated
>
>  LEAK SUMMARY:
>     definitely lost: 0 bytes in 0 blocks
>     indirectly lost: 0 bytes in 0 blocks
>       possibly lost: 0 bytes in 0 blocks
>     still reachable: 1,203,983 bytes in 2,114 blocks
>          suppressed: 0 bytes in 0 blocks
>  Reachable blocks (those to which a pointer was found) are not shown.
>  To see them, rerun with: --leak-check=full --show-leak-kinds=all
>
>  For counts of detected and suppressed errors, rerun with: -v
>  ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
>
> gcc/ChangeLog:
> 	* Makefile.in (selftest-valgrind): New phony target.
> 	* function-tests.c (selftest::build_cfg): Delete pass instances
> 	created by the test.
> 	(selftest::convert_to_ssa): Likewise.
> 	(selftest::test_expansion_to_rtl): Likewise.
> 	* tree-cfg.c (selftest::test_linear_chain): Release dominator
> 	vectors.
> 	(selftest::test_diamond): Likewise.
OK.
jeff



More information about the Gcc-patches mailing list