]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: only test with LTO if LTO support is actually configured
authorFrank Scheiner <frank.scheiner@web.de>
Mon, 12 Jan 2026 09:48:58 +0000 (10:48 +0100)
committerSam James <sam@gentoo.org>
Tue, 27 Jan 2026 09:17:39 +0000 (09:17 +0000)
Bootstrapping GCC (c, c++) on ia64 w/o support for LTO ([1]) showed that
the testsuite (specifically c-c++-common/guality) executes tests with
`-flto` although there was no support for LTO configured.

[1]: https://gcc.gnu.org/pipermail/gcc-testresults/2025-December/865397.html

This is because [...]/guality.exp adds test permutations w/`-flto`
unconditionally. Fix that by checking for LTO support and drop
permutations w/`-flto` if unsupported.

Fixes r10-2142-gec8ac265ff21fb as per [2].

[2]: https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705638.html

gcc/testsuite/ChangeLog:
* gcc.dg/guality/guality.exp: Only test with LTO if supported.
* g++.dg/guality/guality.exp: Likewise.

Signed-off-by: Frank Scheiner <frank.scheiner@web.de>
gcc/testsuite/g++.dg/guality/guality.exp
gcc/testsuite/gcc.dg/guality/guality.exp

index a46f8465a33c5ea7c391c813df6d62e14f0609f7..7f1e7b23a608c39fa40e957c38ce75807e67d37e 100644 (file)
@@ -93,10 +93,17 @@ if {[check_guality "
 
     gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] "" ""
     gcc-dg-runtest $general "" ""
+
+    if [check_effective_target_lto] {
+        set lto_option_list [list "-Og -flto"]
+    } else {
+        set lto_option_list ""  
+    }
+
     set-torture-options \
        [list "-O0" "-Og"] \
        [list {}] \
-       [list "-Og -flto"]
+       $lto_option_list
     gcc-dg-runtest $Og "" ""
 }
 
index 5c892c15479f941b84e28aaa53f5055b1fa606ee..c38ae8899bc0bcc842c16ecc8505f4baa854f7b7 100644 (file)
@@ -108,10 +108,17 @@ if {[check_guality "
 
     gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" ""
     gcc-dg-runtest $general "" "-Wc++-compat"
+
+    if [check_effective_target_lto] {
+        set lto_option_list [list "-Og -flto"]
+    } else {
+        set lto_option_list ""  
+    }
+
     set-torture-options \
        [list "-O0" "-Og"] \
        [list {}] \
-       [list "-Og -flto"]
+       $lto_option_list
     gcc-dg-runtest $Og "" "-Wc++-compat"
 }