https://gcc.gnu.org/g:6fe5fde6748387a74d16ac23774372b650db745e

commit r16-8477-g6fe5fde6748387a74d16ac23774372b650db745e
Author: Rainer Orth <[email protected]>
Date:   Mon Apr 6 14:25:36 2026 +0200

    testsuite: Fix dg-do-if
    
    Tests that use dg-do-if ERROR when the target selector matches, e.g.
    
    ERROR: gcc.dg/vect/vect-simd-clone-16f.c -flto -ffat-lto-objects: compile: 
syntax error for " dg-do-if 1 compile { target { sse2_runtime && { ! 
sse4_runtime } } } "
    
    While the error message isn't particularly helpful, it's from dg.exp
    (dg-do): like the other dg-* procs it expects the line number to be the
    first argument.  However, dg-do-if strips that, so dg-do gets the target
    selector instead of the expected action keyword.
    
    Fixed by no longer stripping the line number.
    
    Tested on amd64-pc-freebsd15.0 (sse2_runtime && !sse4_runtime),
    i386-pc-solaris2.11 and x86_64-pc-linux-gnu (sse2_runtime &&
    sse4_runtime).
    
    2026-04-04  Rainer Orth  <[email protected]>
    
            gcc/testsuite:
            * lib/target-supports-dg.exp (dg-do-if): Don't strip line number
            from args.

Diff:
---
 gcc/testsuite/lib/target-supports-dg.exp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports-dg.exp 
b/gcc/testsuite/lib/target-supports-dg.exp
index f5d386f8f077..39657b10ac28 100644
--- a/gcc/testsuite/lib/target-supports-dg.exp
+++ b/gcc/testsuite/lib/target-supports-dg.exp
@@ -422,9 +422,8 @@ proc check-flags { args } {
 # (possibly the default) prevails.
 
 proc dg-do-if { args } {
-    set args [lreplace $args 0 0]
     # Verify the number of arguments.
-    if { [llength $args] != 2 } {
+    if { [llength $args] != 3 } {
        error "syntax error, need a single action and target selector"
     }
 
@@ -435,7 +434,7 @@ proc dg-do-if { args } {
     }
     
     # Evaluate selector, return if it does not match.
-    switch [dg-process-target-1 [lindex $args 1]] {
+    switch [dg-process-target-1 [lindex $args 2]] {
        "N" { return }
        "P" { return }
     }

Reply via email to