[PATCH,RFC] Introduce RUN_UNDER_VALGRIND in test-suite

Martin Liška mliska@suse.cz
Thu Nov 19 14:38:00 GMT 2015


Hello.

In last two weeks I've removed couple of memory leaks, mainly tight to middle-end.
Currently, a user of the GCC compiler can pass '--enable-checking=valgrind' configure option
that will run all commands within valgrind environment, but as the valgrind runs just with '-q' option,
the result is not very helpful.

I would like to start with another approach, where we can run all tests in test-suite
within the valgrind sandbox and return an exit code if there's an error seen by the tool.
That unfortunately leads to many latent (maybe false positives, FE issues, ...) that can
be efficiently ignored by valgrind suppressions file (the file is part of suggested patch).

The first version of the valgrind.supp can survive running compilation of tramp3d with -O2
and majority of tests in test-suite can successfully finish. Most of memory leaks
mentioned in the file can be eventually fixed.

As I noticed in results log files, most of remaining issues are connected to gcc.c and
lto-wrapper.c files. gcc.c heavily manipulates with strings and it would probably require
usage of a string pool, that can easily eventually removed (just in case of --enable-valgrind-annotations).
The second source file tends to produce memory leaks because of fork/exec constructs. However both
can be improved during next stage1.

Apart from aforementioned issues, the compiler does not contain so many issues and I think it's
doable to prune them and rely on reported valgrind errors.

Patch touches many .exp files, but basically does just couple of modifications:

1) gcc-defs.exp introduces new global variable run_under_valgrind
2) new procedure dg-run-valgrind distinguishes between just passing options to 'gd-test',
   or runs 'dg-test' with additional flags that enable valgrind (using -wrapper)
3) new procedure dg-runtest-valgrind does the similar
4) many changes in corresponding *.exp files that utilize these procedures

The patch should be definitely part of next stage1, but I would appreciate any thoughts
about the described approach?

Thank you,
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Introduce-RUN_UNDER_VALGRIND-support-in-dg-test-proc.patch
Type: text/x-patch
Size: 9153 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151119/e91ca16d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Replace-dg-runtest-with-dg-runtest-valgrind.patch.bz2
Type: application/x-bzip
Size: 9641 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20151119/e91ca16d/attachment-0001.bin>


More information about the Gcc-patches mailing list