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 ICEs with bogus computed goto (PR tree-optimization/58164)


Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>gimple_goto_dest is is_gimple_val, so can be ADDR_EXPR (though just for
>bad
>testcases), and in that case we weren't walking it in some cases.
>
>I've tried to reject ADDR_EXPRs in gimple_goto_dest, but that turned
>out to
>be much larger patch and still incomplete.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
>trunk/4.8?

Ok.  Can you try properly verifying things in verify-gimple?

Thanks,
Richard.

>2013-08-15  Jakub Jelinek  <jakub@redhat.com>
>
>	PR tree-optimization/58164
>	* gimple.c (walk_stmt_load_store_addr_ops): For visit_addr
>	walk gimple_goto_dest of GIMPLE_GOTO.
>
>	* gcc.c-torture/compile/pr58164.c: New test.
>
>--- gcc/gimple.c.jj	2013-05-13 09:44:53.000000000 +0200
>+++ gcc/gimple.c	2013-08-15 15:22:06.745236769 +0200
>@@ -4049,6 +4049,13 @@ walk_stmt_load_store_addr_ops (gimple st
> 	    ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data);
> 	}
>     }
>+  else if (visit_addr
>+	   && gimple_code (stmt) == GIMPLE_GOTO)
>+    {
>+      tree op = gimple_goto_dest (stmt);
>+      if (TREE_CODE (op) == ADDR_EXPR)
>+	ret |= visit_addr (stmt, TREE_OPERAND (op, 0), data);
>+    }
> 
>   return ret;
> }
>--- gcc/testsuite/gcc.c-torture/compile/pr58164.c.jj	2013-08-15
>15:24:04.117313781 +0200
>+++ gcc/testsuite/gcc.c-torture/compile/pr58164.c	2013-08-15
>15:23:47.000000000 +0200
>@@ -0,0 +1,8 @@
>+/* PR tree-optimization/58164 */
>+
>+int
>+foo (void)
>+{
>+  int x = 0;
>+  goto *&x;
>+}
>
>	Jakub



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