This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix VTA ICE on bitfields/packed structs (PR debug/43165)


On Thu, Feb 25, 2010 at 12:17 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> simplify_gen_subreg (simplify_subreg it calls) asserts that the byte is
> multiple of outer mode, but on the testcase below it is not.
> Falling through into the SIGN_EXTRACT resp. ZERO_EXTRACT generation works
> just fine in that case.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux. ?Ok for trunk?

Ok.

Thanks,
Richard.

> 2010-02-24 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR debug/43165
> ? ? ? ?* cfgexpand.c (expand_debug_expr): Don't call simplify_gen_subreg
> ? ? ? ?if bitpos isn't multiple of mode's bitsize.
>
> ? ? ? ?* gcc.dg/torture/pr43165.c: New test.
>
> --- gcc/cfgexpand.c.jj ?2010-02-23 13:48:05.000000000 +0100
> +++ gcc/cfgexpand.c ? ? 2010-02-24 17:12:05.000000000 +0100
> @@ -2534,8 +2534,9 @@ expand_debug_expr (tree exp)
> ? ? ? ? ? ?if (bitpos >= GET_MODE_BITSIZE (opmode))
> ? ? ? ? ? ? ?return NULL;
>
> - ? ? ? ? ? return simplify_gen_subreg (mode, op0, opmode,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bitpos / BITS_PER_UNIT);
> + ? ? ? ? ? if ((bitpos % GET_MODE_BITSIZE (mode)) == 0)
> + ? ? ? ? ? ? return simplify_gen_subreg (mode, op0, opmode,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bitpos / BITS_PER_UNIT);
> ? ? ? ? ?}
>
> ? ? ? ?return simplify_gen_ternary (SCALAR_INT_MODE_P (GET_MODE (op0))
> --- gcc/testsuite/gcc.dg/torture/pr43165.c.jj ? 2010-02-24 17:24:45.000000000 +0100
> +++ gcc/testsuite/gcc.dg/torture/pr43165.c ? ? ?2010-02-24 17:24:57.000000000 +0100
> @@ -0,0 +1,17 @@
> +/* PR debug/43165 */
> +/* { dg-options "-g" } */
> +
> +struct __attribute__((packed)) S
> +{
> + ?unsigned char a;
> + ?unsigned short b;
> + ?unsigned short c;
> + ?unsigned d : 24;
> +};
> +
> +void
> +foo (struct S p)
> +{
> + ?for (; p.c; p.c++)
> + ? ?;
> +}
>
> ? ? ? ?Jakub
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]