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 on __builtin_stack_restore (PR middle-end/34134)


On Dec 3, 2007 11:59 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> This fixes ICE in __builtin_stack_restore expansion if the argument
> isn't a decl, but e.g. NOP_EXPR etc.
>
> Ok for trunk?

Ok.

Thanks,
Richard.

> 2007-12-03  Jakub Jelinek  <jakub@redhat.com>
>
>         PR middle-end/34134
>         * stmt.c (expand_stack_restore): Call expand_normal on var to get
>         rtx for it instead of assuming it will be a VAR_DECL.
>
>         * gcc.c-torture/compile/20071117-1.c: New test.
>
> --- gcc/stmt.c.jj       2007-10-19 14:39:55.000000000 +0200
> +++ gcc/stmt.c  2007-11-17 18:31:17.000000000 +0100
> @@ -1995,7 +1995,7 @@ expand_stack_save (void)
>  void
>  expand_stack_restore (tree var)
>  {
> -  rtx sa = DECL_RTL (var);
> +  rtx sa = expand_normal (var);
>
>    emit_stack_restore (SAVE_BLOCK, sa, NULL_RTX);
>  }
> --- gcc/testsuite/gcc.c-torture/compile/20071117-1.c.jj 2007-11-17 18:35:51.000000000 +0100
> +++ gcc/testsuite/gcc.c-torture/compile/20071117-1.c    2007-11-17 18:35:30.000000000 +0100
> @@ -0,0 +1,13 @@
> +/* PR middle-end/34134 */
> +
> +extern void bar (void *, int);
> +
> +int foo (int i)
> +{
> +  char *p = __builtin_stack_save ();
> +  void *q = __builtin_alloca (i);
> +  bar (q, i);
> +  __builtin_stack_restore (p);
> +  bar ("", 0);
> +  return 6;
> +}
>
>         Jakub
>


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