This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR56990
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Richard Henderson <rth at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 22 Apr 2013 18:54:59 +0200
- Subject: Re: [PATCH] Fix PR56990
- References: <20130422161126 dot GH13346 at redhat dot com> <20130422162100 dot GI12880 at tucnak dot redhat dot com> <517563F5 dot 8080808 at redhat dot com> <20130422165359 dot GI13346 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Apr 22, 2013 at 06:53:59PM +0200, Marek Polacek wrote:
> 2013-04-22 Marek Polacek <polacek@redhat.com>
>
> PR sanitizer/56990
> * tsan.c (instrument_expr): Don't instrument expression
> in case its size is zero.
>
> * gcc.dg/pr56990.c: New test.
Yes, thanks.
> --- gcc/tsan.c.mp 2013-04-19 15:39:46.416450528 +0200
> +++ gcc/tsan.c 2013-04-22 18:49:57.834052631 +0200
> @@ -131,7 +131,8 @@ instrument_expr (gimple_stmt_iterator gs
> if (TREE_READONLY (base))
> return false;
>
> - if (bitpos % (size * BITS_PER_UNIT)
> + if (size == 0
> + || bitpos % (size * BITS_PER_UNIT)
> || bitsize != size * BITS_PER_UNIT)
> return false;
>
> --- gcc/testsuite/gcc.dg/pr56990.c.mp 2013-04-22 17:30:14.523876683 +0200
> +++ gcc/testsuite/gcc.dg/pr56990.c 2013-04-22 17:29:06.704666252 +0200
> @@ -0,0 +1,10 @@
> +/* PR sanitizer/56990 */
> +/* { dg-do compile { target { x86_64-*-linux* && lp64 } } } */
> +/* { dg-options "-fsanitize=thread" } */
> +
> +struct S{};
> +
> +void foo(struct S *p)
> +{
> + *p = (struct S){};
> +}
>
>
> m~
Jakub