From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 25E3E3875DD2 for ; Wed, 27 Sep 2023 18:22:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25E3E3875DD2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-577fff1cae6so8936789a12.1 for ; Wed, 27 Sep 2023 11:22:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1695838976; x=1696443776; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zYpPnjkx3qPZcZRpi070WBaXM6VbNSOcApuTSFg9XT0=; b=W318QvQDCS8XkOIW05WkXZipQVcPZrz4HTUcBGV8YiJJ0KrfluLMMZ38bhQ0zTjbCv JVxzLuwuoaJLoFdWlwbJ/aZaNDpalbhLZdYbNU217LftwYjKP3iXsrms+2HVa2RUgrKb BCdVhlPWhh5Y38mVmZeMfDCoJvI/DSUPPXebyHw7kSrH1r/RLz9j97833cJJ1lRWGzwS 8Y/cAEQfg1fbbSq7XQnr1F5NU9W1Uq7cn+UC6vFyCiDANdNxdOl03oSxg2KQfc3Y52uw UEJ07oJY2W59QtSeU0tQPoIKeVIS+n/QrX8UO2aVvz0MJzvcMpVuFq0yssCX5mtJCT9C yPSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695838976; x=1696443776; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zYpPnjkx3qPZcZRpi070WBaXM6VbNSOcApuTSFg9XT0=; b=QM1K3l/sy9zxks60uuC7GWaXVkUGfvohWjLcFHEZRK839Buji+218/paJnaLZNkINA sypSoilRz0jQsnH3CNpxY0YYfXaHF/zj5mFgHLYT2S6Aa0MIt0U9PIncJ5XFlDI5825N fGYf0JmWAqmyICq89g9fD53dxk4+ZcecCjwsz7t2fqg83lKe4wlc8Q0D2Wp/ZLJxZFjG dkbgTXw1nEvb7OrsrVBOKqmdfbqWBx33K5gLyamTEXv5rqhMaPDe7WRh64Hnoqf6YhHg YwzSA9lU4p2hfIfHFMc3nR5h9YyrEOE3GzH2o9ct2WKmveOHylyW6ms0t8M2oBWCFaUz iCHQ== X-Gm-Message-State: AOJu0YzKKwRDMf+QNZAjLg2CcEjB8T3XYdI6hOPVwPEWUFJflOgjyFZ6 Ex9LsZOHgyYIQbC1coYJYpIpTEnJgEp196fapnHnKg== X-Google-Smtp-Source: AGHT+IH/mJUMu+G8iTlcLKm2H49FFSzIs16hOvmFAmkMIIlXfI96/TeSrjbWaZ97Ij+WigK+GTb9n4ryInq0U4sUkvg= X-Received: by 2002:a17:90a:c915:b0:274:9be9:7ee3 with SMTP id v21-20020a17090ac91500b002749be97ee3mr4474337pjt.8.1695838976045; Wed, 27 Sep 2023 11:22:56 -0700 (PDT) MIME-Version: 1.0 References: <2501e6a4-6f02-429f-8497-226a6b22403c@gmail.com> In-Reply-To: <2501e6a4-6f02-429f-8497-226a6b22403c@gmail.com> From: Joern Rennecke Date: Wed, 27 Sep 2023 19:22:44 +0100 Message-ID: Subject: Re: committed [RISC-V]: Harden test scan patterns To: Jeff Law Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 27 Sept 2023 at 18:22, Jeff Law wrote: > It would help to describe how these patterns were under specified so > that folks don't continue to make the same mistake as new tests get added. dg-final scan-assembler, scan-assembler-not, and scan-assembler-times use a tcl regular expression (often referred to abbreviated as RE), as described in https://www.tcl.tk/man/tcl8.4/TclCmd/re_syntax.html . If your RE is not specific enough, it can match LTO information that the compiler places into its assembly output when the relevant options are provided, which is common when running tests where the test harness iterates over a number of optimization option combinations. Note that '.' is an atom that can match any character. If you want to match a dot specifically, you have to escape it with a backslash: '\.' . When you are matching an instruction mnemonic, an effective way to avoid matching in LTO information is to enforce matching of word start (\m) and/or word end (\M) . Note also that the backslash has to be quoted. If the RE is enclosed in '"' quotes, extra backslashes are needed. That is not necessary when it is enclosed in curly braces. For example, "ld.w" will be matched in: .ascii "h\227\022\212ld@w\251jr\254'\320\255vwj\252\026\016\364" If you write {\mld\.w\M} instead, you avoid this problem. ################################# Where should this go? Maybe somewhere in or linked from https://gcc.gnu.org/codingconventions.html , Testsuite conventions?