public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* infinite recursion detected in gold testcase
@ 2022-01-05  9:35 Alan Modra
  2022-01-05 17:21 ` Cary Coutant
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2022-01-05  9:35 UTC (permalink / raw)
  To: binutils

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;
 }
 

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: infinite recursion detected in gold testcase
  2022-01-05  9:35 infinite recursion detected in gold testcase Alan Modra
@ 2022-01-05 17:21 ` Cary Coutant
  0 siblings, 0 replies; 2+ messages in thread
From: Cary Coutant @ 2022-01-05 17:21 UTC (permalink / raw)
  To: Alan Modra; +Cc: Binutils

>         * testsuite/icf_test.cc: Avoid infinite recursion error.

Thanks!

-cary

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-05 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05  9:35 infinite recursion detected in gold testcase Alan Modra
2022-01-05 17:21 ` Cary Coutant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).