Message ID | alpine.DEB.2.20.2311190446360.5892@tpp.orcam.me.uk |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1602648vqn; Sun, 19 Nov 2023 03:27:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGW2jtpRREH5aQR1tZz/eBp/qXRk8iTvAVQL4MqRE0SFMKGkNjvMvewAMVG5bvufdR7u6bw X-Received: by 2002:a05:620a:17a7:b0:774:cd4:4a58 with SMTP id ay39-20020a05620a17a700b007740cd44a58mr5281320qkb.39.1700393251496; Sun, 19 Nov 2023 03:27:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700393251; cv=pass; d=google.com; s=arc-20160816; b=iKMxwIqJ2l1flUoBIFqchEs3pccL2QFPlKAzyB9CK+Bn6CuU8AYmQEKzkYkjOirPgn n17fVm/8nwSoW/KVHTUdvn3Nef0PdGD2aPbg8vY1qzaKcwgWiUeNb1BVeD3Fmi20Q84d 7TZMvQaiKL3kCydf2Bew1CyuvOP5SqvJWx6OYq3VM0y/rMlyzl+jn1tRqadqVJP0bNur D+qCN6aYka7x+r/sHRXjEFaMkRnZgHA8Yw8usfmnVg21xRPM1b0rPXLsuvaowSYJ79UO 0pKp+efGgb03Be9jOdHOrsi32p/8DRvSaguFIErfrhq/dOPf0dpGHo3IUYqEw4ZWnDm9 rZKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:subject:cc:to:from:date:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=6HmWuGMrP/139AU/FA3DuCEnnKXrQ4e0PD4NTEhmb1U=; fh=TS7yNtIuYLicLQmxMeifc+DNCCzGMySBKYAcIB/nUR4=; b=ie6ZyHNdlqsl2gfTsowxpqWo8c/w3kWezYZz4I3/9qU33oLFSeUKppAZ/L2J4XiSNA e8zzBL6EO4YIw0nRQXohe+1VfdUM6dnm3iKaJHpO8xpeml/KoN6GTIYJpod082tnUz/b 4E2ZT1Y3RCl+ecKc6rZwVLPSVkH5tt7HwCPmjXwa/Cpb8IPPhMh2VVeLBmNQ0n/Fy47B FQFUj/Gf+4gitYM18FG8EdLMtWKmbfcWYlAfFFPbdOK7V++LGoMMRUfdx0h9x8xGyvYC p+y2EmUUKZzU0vOW0YRtrMcK4KkNlNHkSuhZe7z9uMAKhHphG94SGfarJ4lgrUrXGBDH OfGA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=ASW8TZVD; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id q2-20020a05620a0d8200b0076cddf8521bsi5598594qkl.148.2023.11.19.03.27.31 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 03:27:31 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=ASW8TZVD; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 464AB3858C3A for <ouuuleilei@gmail.com>; Sun, 19 Nov 2023 11:27:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 131253858D33 for <gcc-patches@gcc.gnu.org>; Sun, 19 Nov 2023 11:27:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 131253858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 131253858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::534 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700393227; cv=none; b=IGSTHcRs3ElVk2NOYUSiRXNPpbVYQiJYZ7RgSholqKfenkjtJw8SW5OKSuc+CWOEcp58Tj71auqX4HmN9mX0tIwTCf34b0d/9upG8w8HO2p3+epJECL31c8n8cg2TSUrNT7A2Dk4tFkqFmbRz02KvEGEgpTzisS1r+fepcF57pM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700393227; c=relaxed/simple; bh=VORI34Buz1eTIbASme1pzfkoj0SaOcRiEBsHSDVA6KE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=La2nUWF2Wgotp3Iov+/YlqTpkklFSYbzCMz/Ry2TfGitLeA03rMzX+XNgkLw3ZDceAg9eM26+nwnLnMQeOTIqsEyNFFVbmvKO4XvxU2wL2v4/lEpGFS67NDCunIce04u6PNH4UkHxYv1+YmzCm0D3bZI1PaIliYUVHqCD3vFQto= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5437269a661so8798333a12.0 for <gcc-patches@gcc.gnu.org>; Sun, 19 Nov 2023 03:27:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1700393224; x=1700998024; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=6HmWuGMrP/139AU/FA3DuCEnnKXrQ4e0PD4NTEhmb1U=; b=ASW8TZVDdvq8Ta1U18UIcjqXEyF+Cfmv+DNF+2SNTk6KdriuFtp/rMsgFbzZnJnYaP PIQNmudaQhx3p4UCgkiWB7/c2Yd7/H6dvn2DVGihwnhI7cWgc/ed+uLxzSnMea/xAk89 hypEPWP8w87+GQSQ9hstyrYz7Qah+sz3WS1XRYDNR8czdHDLd4Gpqef/tzauJuLZYJfg B4IAKedLZG+bYj5CsEg+9VUipXEhkx/rZwoynRJgWB5ZE3rYJHGOztxhtrfHCimFKgiw 8H4rn+XV917ZzKpgdfFZna8MZYp/aqmX3Nw1OdmwcSLbE1aZHoFNREtytVIHFUrCTNMJ +nLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700393224; x=1700998024; h=mime-version:user-agent:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6HmWuGMrP/139AU/FA3DuCEnnKXrQ4e0PD4NTEhmb1U=; b=sVBgU+9jiju6KmWYOe/VBYYDR1E+1Cip9vZYjuLxIzpuoeKy56rvfJFpDHJCExtWLj JSseZWBGq2jktOZnMDIFbc+jKOwwofzfiqMLoj2hMCfgC55P9lDExF6vd6YzHcwfKJ04 33pq0uFrPzKJDVWdH7crICbd0ZV2HhetVkMddWGmXKoFwOFtNO3ZcS7jBejju2z1f1K4 By+Q9LNCssF5n/psouLiAviOzLW2TJyn8RpmqWH604n2PyIQrW1cdNYB2xHbHgrAxj+/ GHbBWAT/8p456BwJQoaFI6+hC8BCxTHKGXXUuYni9qRln1B5ZNrq0Zadlj+/tNUAntUV so9g== X-Gm-Message-State: AOJu0YyE7Bmedvh7IMh5bxLdbxm12wYPrXVTNv/jR6woNxiMDh1HAWaP XFqT/tphepQPnfmjK5bIIByZukEMRtG14bsh54OozA== X-Received: by 2002:a17:906:112:b0:9fd:79b3:e2b3 with SMTP id 18-20020a170906011200b009fd79b3e2b3mr763853eje.9.1700393224221; Sun, 19 Nov 2023 03:27:04 -0800 (PST) Received: from [192.168.219.3] ([78.8.192.131]) by smtp.gmail.com with ESMTPSA id a21-20020a50ff15000000b0053de19620b9sm2463693edu.2.2023.11.19.03.27.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Nov 2023 03:27:03 -0800 (PST) Date: Sun, 19 Nov 2023 11:27:02 +0000 (GMT) From: "Maciej W. Rozycki" <macro@embecosm.com> To: gcc-patches@gcc.gnu.org cc: Rainer Orth <ro@cebitec.uni-bielefeld.de>, Mike Stump <mikestump@comcast.net> Subject: [PATCH] testsuite: Fix subexpressions with `scan-assembler-times' Message-ID: <alpine.DEB.2.20.2311190446360.5892@tpp.orcam.me.uk> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, KAM_TK, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782991554415447089 X-GMAIL-MSGID: 1782991554415447089 |
Series |
testsuite: Fix subexpressions with `scan-assembler-times'
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Maciej W. Rozycki
Nov. 19, 2023, 11:27 a.m. UTC
We have an issue with `scan-assembler-times' handling expressions using subexpressions as produced by capturing parentheses `()' in an odd way, and one that is inconsistent with `scan-assembler', `scan-assembler-not', etc. The problem comes from calling `regexp' with `-inline -all', which causes a list to be returned that would otherwise be placed in match variables. Consequently if we have say: /* { dg-final { scan-assembler-times "\\s(foo|bar)\\s" 1 } } */ in a test case and there is a lone `foo' present in output being matched, then our invocation of `regexp -inline -all' in `scan-assembler-times' will return: { foo } foo and that in turn will confuse our match count calculation as `llength' will return 2 rather than 1, making the test fail even though `foo' was only actually matched once. It seems unclear why we chose to call `regexp' in such an odd way in the first place just to figure out the number of matches. The first version of TCL that supports the `-all' option to `regexp' is 8.3, and according to its documentation[1][2] `regexp' already returns the number of matches found whenever `-all' has been used *unless* `-inline' has also been used. Remove the `-inline' option then along with the `llength' invocation. References: [1] "Tcl Built-In Commands - regexp manual page", <https://www.tcl.tk/man/tcl8.2.3/TclCmd/regexp.html> [2] "Tcl Built-In Commands - regexp manual page", <https://www.tcl.tk/man/tcl8.3/TclCmd/regexp.html> gcc/testsuite/ * lib/scanasm.exp (scan-assembler-times): Remove the `-inline' option to `regexp' and the wrapping `llength' call. --- Hi, Verified with the `riscv64-linux-gnu' target and the C language testsuite. OK to apply? Maciej --- gcc/testsuite/lib/scanasm.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) gcc-test-scan-assembler-times-count.diff
Index: gcc/gcc/testsuite/lib/scanasm.exp =================================================================== --- gcc.orig/gcc/testsuite/lib/scanasm.exp +++ gcc/gcc/testsuite/lib/scanasm.exp @@ -505,7 +505,7 @@ proc scan-assembler-times { args } { close $fd regsub -all {(^|\n)[[:space:]]*\.section[[:space:]]*\.gnu\.lto_(?:[^\n]*\n(?![[:space:]]*\.(section|text|data|bss)))*[^\n]*\n} $text {\1} text - set result_count [llength [regexp -inline -all -- $pattern $text]] + set result_count [regexp -all -- $pattern $text] if {$result_count == $times} { pass "$testcase scan-assembler-times $pp_pattern $times" } else {