On Mon, Apr 29, 2013 at 9:14 PM, Jakub Jelinek <ja...@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  <ja...@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

Reply via email to