From: Alan Modra Date: Wed, 5 Jan 2022 01:09:12 +0000 (+1030) Subject: infinite recursion detected in gold testcase X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9255b7808f1e414e36a2e82a4d53c5967e5e2b4;p=binutils-gdb.git 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. --- diff --git a/gold/testsuite/icf_test.cc b/gold/testsuite/icf_test.cc index 7abd2ae6328..d7de701cba0 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; }