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 ICE during expand_debug_expr


On Sun, Oct 18, 2009 at 9:21 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> On this, slightly invalid, testcase GCC ICEs with -O2 -g.
> For MEM_P op0 negative bitpos can and is handled, but for e.g. x[-1]
> when x is in a register simplify_gen_subreg ICEs when seeing the negative
> offset.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux. ?Ok for
> trunk?

Ok.

Thanks,
Richard.

> 2009-10-18 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?* cfgexpand.c (expand_debug_expr): Fail if bitpos < 0 for non-MEM
> ? ? ? ?op0.
>
> ? ? ? ?* gcc.dg/debug/vta-3.c: New test.
>
> --- gcc/cfgexpand.c.jj ?2009-10-16 01:45:11.000000000 +0200
> +++ gcc/cfgexpand.c ? ? 2009-10-18 14:02:25.000000000 +0200
> @@ -2593,6 +2593,9 @@ expand_debug_expr (tree exp)
> ? ? ? ?if (bitpos == 0 && mode == GET_MODE (op0))
> ? ? ? ? ?return op0;
>
> + ? ? ? ?if (bitpos < 0)
> + ? ? ? ? ?return NULL;
> +
> ? ? ? ?if ((bitpos % BITS_PER_UNIT) == 0
> ? ? ? ? ? ?&& bitsize == GET_MODE_BITSIZE (mode1))
> ? ? ? ? ?{
> --- gcc/testsuite/gcc.dg/debug/vta-3.c.jj ? ? ? 2009-10-18 14:44:12.000000000 +0200
> +++ gcc/testsuite/gcc.dg/debug/vta-3.c ?2009-10-18 14:44:32.000000000 +0200
> @@ -0,0 +1,17 @@
> +/* { dg-do compile } */
> +
> +int
> +foo (void)
> +{
> + ?union { char e[8]; int i; } a, b;
> + ?char *c, *d;
> + ?unsigned int i;
> + ?c = a.e;
> + ?d = &b.e[sizeof (int) - 1];
> + ?for (i = 0; i < sizeof (int); i++)
> + ? ?{
> + ? ? ?*d = *c++;
> + ? ? ?--d;
> + ? ?}
> + ?return b.i;
> +}
>
>
> ? ? ? ?Jakub
>


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