re PR middle-end/34134 (ICE when using __builtin_stack_restore)
authorJakub Jelinek <jakub@redhat.com>
Tue, 4 Dec 2007 21:55:32 +0000 (22:55 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 4 Dec 2007 21:55:32 +0000 (22:55 +0100)
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.

From-SVN: r130609

gcc/ChangeLog
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20071117-1.c [new file with mode: 0644]

index a7eb6a2847bcca67b7728459d308a9a83bbbfdfa..050bc681c8b81ca47f2f7417761833b457620aaf 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-04  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.
+
 2007-12-04  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        * c-parser (c_parser_statement_after_labels): Move error from here...
index 7d1a2662507e3876905c9282730e338600701aa5..aacb1840dec0735803130429c38f0dc14172d388 100644 (file)
@@ -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);
 }
index 5407e15f6456a857937fafc797f3bc9b9c63e70a..f903d83a8cb5fb691507832047686600274d4635 100644 (file)
@@ -1,3 +1,8 @@
+2007-12-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/34134
+       * gcc.c-torture/compile/20071117-1.c: New test.
+
 2007-12-04  Douglas Gregor  <doug.gregor@gmail.com>
 
        PR c++/34101
diff --git a/gcc/testsuite/gcc.c-torture/compile/20071117-1.c b/gcc/testsuite/gcc.c-torture/compile/20071117-1.c
new file mode 100644 (file)
index 0000000..efcd512
--- /dev/null
@@ -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;
+}