]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR ipa/61986 (ICE on valid code at -O3 on x86_64-linux-gnu indecide_about_value...
authorMartin Jambor <mjambor@suse.cz>
Wed, 3 Sep 2014 16:33:10 +0000 (18:33 +0200)
committerMartin Jambor <jamborm@gcc.gnu.org>
Wed, 3 Sep 2014 16:33:10 +0000 (18:33 +0200)
2014-09-03  Martin Jambor  <mjambor@suse.cz>

PR ipa/61986
* ipa-cp.c (find_aggregate_values_for_callers_subset): Chain
created replacements in ascending order of offsets.
(known_aggs_to_agg_replacement_list): Likewise.

gcc/testsuite/
* gcc.dg/ipa/pr61986.c: New test.

From-SVN: r214884

gcc/ChangeLog
gcc/ipa-cp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/ipa/pr61986.c [new file with mode: 0644]

index 0f872fa1ade78bbd1102b295d2d1e47645363b1e..43f5df40075be0a76a1a952e0b8469e8a6b8bc34 100644 (file)
@@ -1,3 +1,10 @@
+2014-09-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/61986
+       * ipa-cp.c (find_aggregate_values_for_callers_subset): Chain
+       created replacements in ascending order of offsets.
+       (known_aggs_to_agg_replacement_list): Likewise.
+
 2014-09-01  Marek Polacek  <polacek@redhat.com>
 
        Backport from mainline
index bd45575cba634dbeb99f2307cb1fdd96155fa4a6..55e02b94a11aab77c70fa759a301b8a02a3242fe 100644 (file)
@@ -3002,7 +3002,8 @@ find_aggregate_values_for_callers_subset (struct cgraph_node *node,
                                          vec<cgraph_edge_p> callers)
 {
   struct ipa_node_params *dest_info = IPA_NODE_REF (node);
-  struct ipa_agg_replacement_value *res = NULL;
+  struct ipa_agg_replacement_value *res;
+  struct ipa_agg_replacement_value **tail = &res;
   struct cgraph_edge *cs;
   int i, j, count = ipa_get_param_count (dest_info);
 
@@ -3046,14 +3047,15 @@ find_aggregate_values_for_callers_subset (struct cgraph_node *node,
          v->offset = item->offset;
          v->value = item->value;
          v->by_ref = plats->aggs_by_ref;
-         v->next = res;
-         res = v;
+         *tail = v;
+         tail = &v->next;
        }
 
     next_param:
       if (inter.exists ())
        inter.release ();
     }
+  *tail = NULL;
   return res;
 }
 
@@ -3062,7 +3064,8 @@ find_aggregate_values_for_callers_subset (struct cgraph_node *node,
 static struct ipa_agg_replacement_value *
 known_aggs_to_agg_replacement_list (vec<ipa_agg_jump_function_t> known_aggs)
 {
-  struct ipa_agg_replacement_value *res = NULL;
+  struct ipa_agg_replacement_value *res;
+  struct ipa_agg_replacement_value **tail = &res;
   struct ipa_agg_jump_function *aggjf;
   struct ipa_agg_jf_item *item;
   int i, j;
@@ -3076,9 +3079,10 @@ known_aggs_to_agg_replacement_list (vec<ipa_agg_jump_function_t> known_aggs)
        v->offset = item->offset;
        v->value = item->value;
        v->by_ref = aggjf->by_ref;
-       v->next = res;
-       res = v;
+       *tail = v;
+       tail = &v->next;
       }
+  *tail = NULL;
   return res;
 }
 
index a5f098d417ec8f1c76b3377864c96f0321b82a68..7d328751cb3283b63fa19a054ea010581b6aeae0 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-03  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/61986
+       * gcc.dg/ipa/pr61986.c: New test.
+
 2014-08-26  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        * gfortran.dg/bessel_7.f90: Bump allowed precision to avoid
diff --git a/gcc/testsuite/gcc.dg/ipa/pr61986.c b/gcc/testsuite/gcc.dg/ipa/pr61986.c
new file mode 100644 (file)
index 0000000..8d2f658
--- /dev/null
@@ -0,0 +1,48 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a, b, c;
+
+struct S
+{
+  int f0;
+  int f1;
+} d;
+
+static int fn2 (struct S);
+void fn3 (struct S);
+
+void
+fn1 (struct S p)
+{
+  struct S h = { 0, 0 };
+  fn3 (p);
+  fn2 (h);
+}
+
+int
+fn2 (struct S p)
+{
+  struct S j = { 0, 0 };
+  fn3 (p);
+  fn2 (j);
+  return 0;
+}
+
+void
+fn3 (struct S p)
+{
+  for (; b; a++)
+    c = p.f0;
+  fn1 (d);
+}
+
+void
+fn4 ()
+{
+  for (;;)
+    {
+      struct S f = { 0, 0 };
+      fn1 (f);
+    }
+}