This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix for PR/62089 (enable missing Asan checks)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Yury Gribov <y dot gribov at samsung dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Viacheslav Garbuzov <v dot garbuzov at samsung dot com>
- Date: Wed, 13 Aug 2014 12:13:58 +0200
- Subject: Re: [PATCH] Fix for PR/62089 (enable missing Asan checks)
- Authentication-results: sourceware.org; auth=none
- References: <53EB395D dot 2060604 at samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Aug 13, 2014 at 02:09:33PM +0400, Yury Gribov wrote:
> --- a/gcc/asan.c
> +++ b/gcc/asan.c
> @@ -1690,9 +1690,7 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
> int volatilep = 0, unsignedp = 0;
> tree inner = get_inner_reference (t, &bitsize, &bitpos, &offset,
> &mode, &unsignedp, &volatilep, false);
> - if (((size_in_bytes & (size_in_bytes - 1)) == 0
> - && (bitpos % (size_in_bytes * BITS_PER_UNIT)))
> - || bitsize != size_in_bytes * BITS_PER_UNIT)
> + if (bitpos % BITS_PER_UNIT || bitsize != size_in_bytes * BITS_PER_UNIT)
> {
> if (TREE_CODE (t) == COMPONENT_REF
> && DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (t, 1)) != NULL_TREE)
I wonder if we just shouldn't handle COMPONENT_REFs with
DECL_BIT_FIELD_REPRESENTATIVE that way unconditionally.
So, do the if (TREE_CODE (t) == COMPONENT_REF ... before the other checks,
and
else if (bitpos % BITS_PER_UNIT || bitsize != size_in_bytes * BITS_PER_UNIT)
return;
Jakub