From b9255b7808f1e414e36a2e82a4d53c5967e5e2b4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 5 Jan 2022 11:39:12 +1030 Subject: infinite recursion detected in gold testcase gold/testsuite/icf_test.cc:32:5: error: infinite recursion detected [-Werror=infinite-recursion] 32 | int kept_func() | ^~~~~~~~~ * testsuite/icf_test.cc: Avoid infinite recursion error. --- gold/testsuite/icf_test.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gold') diff --git a/gold/testsuite/icf_test.cc b/gold/testsuite/icf_test.cc index 7abd2ae..d7de701 100644 --- a/gold/testsuite/icf_test.cc +++ b/gold/testsuite/icf_test.cc @@ -29,19 +29,21 @@ int common() return 1; } -int kept_func() +int kept_func(int i) { common(); // Recursive call. - kept_func(); + if (i) + kept_func(i - 1); return 1; } -int folded_func() +int folded_func(int i) { common(); // Recursive call. - folded_func(); + if (i) + folded_func(i - 1); return 1; } -- cgit v1.1