re PR ipa/85549 (Infinite loop in ilmbase package)
authorMartin Jambor <mjambor@suse.cz>
Fri, 27 Apr 2018 20:32:18 +0000 (22:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 27 Apr 2018 20:32:18 +0000 (22:32 +0200)
PR ipa/85549
* ipa-cp.c (find_aggregate_values_for_callers_subset): Make sure
the jump function allows for passing through aggregate values.

* g++.dg/ipa/pr85549.C: New test.

From-SVN: r259730

gcc/ChangeLog
gcc/ipa-cp.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ipa/pr85549.C [new file with mode: 0644]

index 048ec0bfbffaf71186e745629b5f96ba77a78127..8513d2dec2ff2ebfd76c8a6b34ce2acabe639f0c 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-27  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/85549
+       * ipa-cp.c (find_aggregate_values_for_callers_subset): Make sure
+       the jump function allows for passing through aggregate values.
+
 2018-04-27  David Malcolm  <dmalcolm@redhat.com>
 
        * input.h (in_system_header_at): Convert from macro to inline
index 1b8f335fd32a85a9cb1bda769003c76000903be0..4f28a55b8620d821a7c9acbb107d153dba2cf652 100644 (file)
@@ -4372,7 +4372,9 @@ find_aggregate_values_for_callers_subset (struct cgraph_node *node,
        {
          struct ipa_jump_func *jfunc
            = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
-         if (self_recursive_pass_through_p (cs, jfunc, i))
+         if (self_recursive_pass_through_p (cs, jfunc, i)
+             && (!plats->aggs_by_ref
+                 || ipa_get_jf_pass_through_agg_preserved (jfunc)))
            continue;
          inter = intersect_aggregates_with_edge (cs, i, inter);
 
index 9002abf723fef608eeaa7e082ecaf464a102f460..47da0434d8a608a94c6aa98b52bf540cb7c78dc1 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-27  Martin Jambor  <mjambor@suse.cz>
+
+       PR ipa/85549
+       * g++.dg/ipa/pr85549.C: New test.
+
 2018-04-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/85553
diff --git a/gcc/testsuite/g++.dg/ipa/pr85549.C b/gcc/testsuite/g++.dg/ipa/pr85549.C
new file mode 100644 (file)
index 0000000..ae0336e
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include <vector>
+
+#define N 10
+
+static void visit(int &level, int n, int k, std::vector< int > &value) {
+  level = level + 1;
+  value[k] = level;
+  for (int i = 0 ; i < n; i++)
+    if (value[i] == 0)
+      visit(level, n, i, value);
+}
+void permutations()
+{
+  std::vector< int > value(N);
+  int level = -1;
+  visit(level, N, 0, value);
+}
+void testExtendByBox() {
+  permutations();
+}
+
+int main() {
+  testExtendByBox();
+  return 0;
+}