[gcc r15-11428] testsuite: tolerate argc==0 [PR126194]

Alexandre Oliva via Gcc-cvs <[email protected]> Fri, 31 Jul 2026 05:32:18 +0000 (GMT)
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:2c5ca7006e2b9f21c380a38f21807153814bf2f9

commit r15-11428-g2c5ca7006e2b9f21c380a38f21807153814bf2f9
Author: Alexandre Oliva <[email protected]>
Date:   Fri Jul 31 02:12:09 2026 -0300

    testsuite: tolerate argc==0 [PR126194]
    
    Some embedded targets set argc to zero when calling main, but then
    pr126194 testcase fails because it uses argc > 0 to enable the code
    that allows the test to pass.  Derive the argc passed to the primary
    LTOed entry point from argc >= 0, so that it isn't a link-time
    constant, but the guarding condition always passes at runtime.
    
    
    for  gcc/testsuite/ChangeLog
    
            PR tree-optimization/126194
            * g++.dg/lto/pr126194_2.C (main): Tolerate argc == 0.
    (cherry picked from commit 7c38c56214bf2809399a2198441bb48ee1b00512)

Diff:
---
 gcc/testsuite/g++.dg/lto/pr126194_2.C | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.dg/lto/pr126194_2.C b/gcc/testsuite/g++.dg/lto/pr126194_2.C
index 3c024f47a196..9725a4239cdf 100644
--- a/gcc/testsuite/g++.dg/lto/pr126194_2.C
+++ b/gcc/testsuite/g++.dg/lto/pr126194_2.C
@@ -4,5 +4,5 @@ extern "C" int run_repro(int argc);
 
 int main(int argc, char**)
 {
-    return run_repro(argc);
+    return run_repro(argc >= 0);
 }