diff options
author | Alan Modra <amodra@gmail.com> | 2022-01-05 11:39:12 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-01-05 16:55:57 +1030 |
commit | b9255b7808f1e414e36a2e82a4d53c5967e5e2b4 (patch) | |
tree | 42508f9506f7e7c5e2923964e62966b0b56bbf51 /gold/testsuite/icf_test.cc | |
parent | 5224aea8c24fba272cf55261021c932fd05a7438 (diff) | |
download | gdb-b9255b7808f1e414e36a2e82a4d53c5967e5e2b4.zip gdb-b9255b7808f1e414e36a2e82a4d53c5967e5e2b4.tar.gz gdb-b9255b7808f1e414e36a2e82a4d53c5967e5e2b4.tar.bz2 |
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.
Diffstat (limited to 'gold/testsuite/icf_test.cc')
-rw-r--r-- | gold/testsuite/icf_test.cc | 10 |
1 files changed, 6 insertions, 4 deletions
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; } |