[PATCH] LeakSanitizer testsuite

Jakub Jelinek jakub@redhat.com
Mon Mar 24 09:22:00 GMT 2014


On Thu, Mar 20, 2014 at 10:22:38AM +0400, Maxim Ostapenko wrote:
> Hi,
> 
> This patch adds initial set of tests and dg infrastructure for
> LeakSanitizer runtime.
> 
> Tested on x86_64.
> 
> Ok to commit?

Are you sure we need testsuite for something that doesn't have a GCC code
generation counterpart at all?

In any case, this isn't ok for 4.9, we are too late in the development
cycle.
Perhaps it could go in during next stage1.

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/lsan/fork.c
> @@ -0,0 +1,23 @@
> +// Test that thread local data is handled correctly after forking without exec().
> +/* { dg-do run } */
> +
> +#include <assert.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <sys/wait.h>
> +#include <unistd.h>
> +
> +__thread void *thread_local_var;

Tests using __thread should be guarded with
/* { dg-require-effective-target tls_runtime } */
Also, I wonder given the explicit uses of unistd.h if you just shouldn't
limit the test to *-*-linux* or similar.
> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/lsan/swapcontext-1.c
> @@ -0,0 +1,41 @@
> +// We can't unwind stack if we're running coroutines on heap-allocated
> +// memory. Make sure we don't report these leaks.

I guess setcontext/getcontext/makecontext is supported even on far fewer
OSes.

	Jakub



More information about the Gcc-patches mailing list