This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't instrument with -fsanitize=thread accesses to DECL_HARD_REGISTER vars (PR tree-optimization/57104)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Dodji Seketeli <dseketel at redhat dot com>, gcc-patches at gcc dot gnu dot org, Dmitry Vyukov <dvyukov at google dot com>
- Date: Tue, 30 Apr 2013 10:05:15 +0200
- Subject: Re: [PATCH] Don't instrument with -fsanitize=thread accesses to DECL_HARD_REGISTER vars (PR tree-optimization/57104)
- References: <20130429191415 dot GJ28963 at tucnak dot redhat dot com>
On Mon, Apr 29, 2013 at 9:14 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> DECL_HARD_REGISTER vars don't live in memory, thus they can't be
> addressable.
>
> The following patch fixes the ICE, ok for trunk/4.8?
Ok.
Thanks,
Richard.
> 2013-04-29 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/57104
> * tsan.c (instrument_expr): Don't instrument accesses to
> DECL_HARD_REGISTER VAR_DECLs.
>
> * gcc.dg/pr57104.c: New test.
>
> --- gcc/tsan.c.jj 2013-04-24 12:07:12.000000000 +0200
> +++ gcc/tsan.c 2013-04-29 21:06:48.975888478 +0200
> @@ -128,7 +128,9 @@ instrument_expr (gimple_stmt_iterator gs
> return false;
> }
>
> - if (TREE_READONLY (base))
> + if (TREE_READONLY (base)
> + || (TREE_CODE (base) == VAR_DECL
> + && DECL_HARD_REGISTER (base)))
> return false;
>
> if (size == 0
> --- gcc/testsuite/gcc.dg/pr57104.c.jj 2013-04-29 21:09:46.812948131 +0200
> +++ gcc/testsuite/gcc.dg/pr57104.c 2013-04-29 21:09:39.000000000 +0200
> @@ -0,0 +1,12 @@
> +/* PR tree-optimization/57104 */
> +/* { dg-do compile { target { x86_64-*-linux* && lp64 } } } */
> +/* { dg-options "-fsanitize=thread" } */
> +
> +register int r asm ("r14");
> +int v;
> +
> +int
> +foo (void)
> +{
> + return r + v;
> +}
>
> Jakub