On July 14, 2016 5:28:03 PM GMT+02:00, Jakub Jelinek <ja...@redhat.com> wrote:
>Hi!
>
>As mentioned in the PR, we ICE on the following testcase, because
>tree-data-ref.c for VIEW_CONVERT_EXPR<struct S>(0) attempts to create
>ADDR_EXPR of INTEGER_CST, which is not really valid.
>
>I've successfully bootstrapped/regtested earlier version of this patch
>with is_gimple_constant instead of is_gimple_min_invariant on
>x86_64-linux
>and i686-linux, ok for trunk if even this version succeeds?

OK.

Richard.

>2016-07-14  Jakub Jelinek  <ja...@redhat.com>
>
>       PR tree-optimization/71872
>       * tree-data-ref.c (get_references_in_stmt): Ignore references
>       with is_gimple_constant get_base_address.
>
>       * gcc.c-torture/compile/pr71872.c: New test.
>
>--- gcc/tree-data-ref.c.jj     2016-07-11 22:18:08.000000000 +0200
>+++ gcc/tree-data-ref.c        2016-07-14 14:03:57.902899566 +0200
>@@ -3868,7 +3868,8 @@ get_references_in_stmt (gimple *stmt, ve
>       if (DECL_P (op1)
>         || (REFERENCE_CLASS_P (op1)
>             && (base = get_base_address (op1))
>-            && TREE_CODE (base) != SSA_NAME))
>+            && TREE_CODE (base) != SSA_NAME
>+            && !is_gimple_min_invariant (base)))
>       {
>         ref.ref = op1;
>         ref.is_read = true;
>--- gcc/testsuite/gcc.c-torture/compile/pr71872.c.jj   2016-07-14
>14:14:17.132889043 +0200
>+++ gcc/testsuite/gcc.c-torture/compile/pr71872.c      2016-07-14
>14:14:05.000000000 +0200
>@@ -0,0 +1,15 @@
>+/* PR tree-optimization/71872 */
>+
>+struct __attribute__((may_alias)) S { int a; };
>+
>+void
>+foo (int *x, struct S *y)
>+{
>+  int i;
>+  for (i = 0; i < 16; i++)
>+    {
>+      int a = 0;
>+      if (*x)
>+        *(struct S *) y = *(struct S *) &a;
>+    }
>+}
>
>       Jakub


Reply via email to