From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by sourceware.org (Postfix) with ESMTPS id 4AED53858D33 for ; Sun, 19 Nov 2023 23:45:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4AED53858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4AED53858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::2c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700437501; cv=none; b=YPKFBES/tgWI2CbRIF38eF0RNDdF6nx+YXSY5+d9diIcHK0nGfj7g+n7gRTWi1cagiIEcnGM2YiasrENPlQylLui4QmjEaYorPBir0huwY1A52XmAfcAYbyXep3q3kUTvIi7BZQAqKHnX1h7uisf/YFzJ706Xgwe6A/L97sPRM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700437501; c=relaxed/simple; bh=/YOSJzpjMJa1fYsTyqoJvWpm11AUQjjtL+2+D2sUi9w=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=T+KrGailMexozuqcccAbV1UjAyOfdxysb147fQJvWA3p/SELFnK7nLDtF5hwPJ5rr/BvrtNg2Cb6t7DQH9LPa/bWr9jEvsYY1+NxHgfd40jaJf6QnL0JdBt7Tm2HBki/0iwF0KDEdQOiCZ3JHfE/zKJk19XSEIoi/0z6jMxXJdE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1f5da5df68eso792563fac.2 for ; Sun, 19 Nov 2023 15:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700437499; x=1701042299; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YYemRtGjeJoxmR42yp9J/E+fkjYlOw6ZtGWTR7W9aiU=; b=FYBNVXudmcYK74Ky4cDrI45Kt23/WKVeuRx2UsK8ACC6KjuU+Q+qpZZyRqqxMRfNME gU/ShbW++YGxoKFSxB2YPSvwWrY88dhc8AtwPFNMH9QFRLEBjGuGpY396Dl/n20WPBsi NpCaaKlJ0P2GjAaWzBEaxmD4VYIOmGiDDpv8jdVwDjlfKMbZTPGavwwTRFYHFzkUdGfE SB0kWQBud6ibd5DgWnJOP8S7IQgwYwbTfZ5DGBcJ7Z+edb8ss795E8snGOwBMvkWne3u 8zt/jjtRtg/rM5kMHG2Ydqkmm4Yg8wsUdZO9cHLTf8vVHtjwSKZ5d6/XUaufu2Rz7pyo LjvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700437499; x=1701042299; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YYemRtGjeJoxmR42yp9J/E+fkjYlOw6ZtGWTR7W9aiU=; b=VP6vF4bvfrf4Kv+BNzFRfz8GCYLzRsvJuhDtxVCy2oQNsjvqoU6Gx5d42WhmSrVXhV cnbox1iJFYjgQJ9YQWM5YJPQtxBHkPKwoSDH4N1f2KDWDQ+1adFfmSNGfo1GpfsBDhl9 HIceNJimKQDM+LVNt9EUVV7Ohut6ltu+P8w0m+BZ+7g04BnkF0ldoFF7NyC7hPv6znpg IDQluCg75d9zT7LfxP4Deya1Q3Te3IPuCyAw1tI4ipOjve5ttleuEoh/yum67lPaT55Z 0yh6bkfH5jToXVDMfJnFZs5iFC4mYWeop5jpwXXc90K5CzDghRQd/jJEW9PGk4P5wyfz f77A== X-Gm-Message-State: AOJu0Yw2it8X3JzoTw9/LFvhXb6UwGvL5QpuxSiyE+q2UQhAKo612Mfw Z8zNnwX2DcH3e8JgVUJJRRI= X-Google-Smtp-Source: AGHT+IFgPkgpd8HbpFuUZcwlDsVu6pWFKEUrl0GOCZ6KPULYtM0hC+RknJkYPFBDwASm0N+34YWHvQ== X-Received: by 2002:a05:6870:3d8b:b0:1ef:93d9:15c9 with SMTP id lm11-20020a0568703d8b00b001ef93d915c9mr695516oab.0.1700437499545; Sun, 19 Nov 2023 15:44:59 -0800 (PST) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id v21-20020a05683018d500b006ce2e464a45sm1008645ote.29.2023.11.19.15.44.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Nov 2023 15:44:59 -0800 (PST) Message-ID: Date: Sun, 19 Nov 2023 16:44:58 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] testsuite: Fix subexpressions with `scan-assembler-times' Content-Language: en-US To: "Maciej W. Rozycki" , gcc-patches@gcc.gnu.org Cc: Rainer Orth , Mike Stump References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: On 11/19/23 04:27, Maciej W. Rozycki wrote: > 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", > > > [2] "Tcl Built-In Commands - regexp manual page", > > > 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? Not sure why it is the way it is -- I walked back to Zdenek's change which introduced the scan-assembler-times and nothing about the -inline argument. OK, but be on the lookout for scan-asm problems on other targets over the next few days. Jeff