From cf25444273b4bab2b60e5c3f811883bf2dab2b85 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Fri, 27 Apr 2018 22:32:18 +0200 Subject: [PATCH] re PR ipa/85549 (Infinite loop in ilmbase package) 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 | 6 ++++++ gcc/ipa-cp.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ipa/pr85549.C | 28 ++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr85549.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 048ec0bfbff..8513d2dec2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-27 Martin Jambor + + 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 * input.h (in_system_header_at): Convert from macro to inline diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 1b8f335fd32..4f28a55b862 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9002abf723f..47da0434d8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-27 Martin Jambor + + PR ipa/85549 + * g++.dg/ipa/pr85549.C: New test. + 2018-04-27 Jakub Jelinek 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 index 00000000000..ae0336e16b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr85549.C @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include + +#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; +} -- 2.30.2