From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id CAFC83857C71 for ; Wed, 27 Sep 2023 22:13:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CAFC83857C71 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32172f8a5dbso10353888f8f.3 for ; Wed, 27 Sep 2023 15:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695852782; x=1696457582; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=y4g8NG+2Zf3NE6aCoF83I56XD2+h/+5GqGOW6PhTRKw=; b=cDMvXihRHH4g0UTwHvdAfiUnU2NfFE365xzlpedS8kMqtw4e1CsvMhXFOu3EIODb2h kK4Uqie7bN5KpX6o3joccel1QM1fGDeHt3TmnFY/XxkxilpV9LvZ+pIy/4l3j5eGg9T1 +jqdAT1KbFf6gHylE5vhSySxblufAKTuP0sPQ5TjcmPwslFMkNQVI/+g3HtzyVKXrjqf 5pdblRWx27OKTZ+zpz7Nug4vxphsPjR6koi6/JjvNLgyYnKE5HChWMMYmpALJS48Ucr/ XN7AJI5nHMtUkh7FSia4omvGOIc9nZ2QwD+jc5RFbgyOpY2499B5ymVpIG09IefGTXWt 2wAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695852782; x=1696457582; h=content-transfer-encoding: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=y4g8NG+2Zf3NE6aCoF83I56XD2+h/+5GqGOW6PhTRKw=; b=PF/EvocN43UsEIyDaLRXM8TnRazl6cjuJaSPvVbbachRI8bjLaI7Fyc3drsr0bN0Wb ewyHJ3N/dkhw0p6/l/HDMJCs6lOk2DcUf6l1wCmZhpcb+7YOcVgDZMF1c0XfJaAxTlKR zuA44LkXMknhzVkqFmGD7av83tF0MRFpb3wnj4N7gjU7VXCLyxCXwjeN8VRbvcgW8DtS 2PU7K9QuOfmufOppzgGaHopH4ug8sF3KTfKVhi39hiBPr9W5/DUlM0F7IntTX747qnuJ MJEvca/L/LRqkGBDoEhwRRmWKMsQSmixODo0OH0JSaDnoHqrAXc8RJv2nEm0cGMY5QFN XrQw== X-Gm-Message-State: AOJu0YwcjtDU2MNIcxttlxffLxifeWTAkeubcYEB8XuI7GbvW6LLoriv w7l+bkOAAEXGPEuU7PDwack011VItKAbT0534l0= X-Google-Smtp-Source: AGHT+IHW25x5TrrCU5LwN9f7pwSlSfvUFaAAgevR1pRN7HnMqyXLWG3Xa7CBlcMOQzbpn0kmhyFKF+kem9/UA5vo/NM= X-Received: by 2002:a5d:62d1:0:b0:323:2296:b463 with SMTP id o17-20020a5d62d1000000b003232296b463mr2849818wrv.15.1695852781891; Wed, 27 Sep 2023 15:13:01 -0700 (PDT) MIME-Version: 1.0 References: <2501e6a4-6f02-429f-8497-226a6b22403c@gmail.com> In-Reply-To: From: Andrew Pinski Date: Wed, 27 Sep 2023 15:12:49 -0700 Message-ID: Subject: Re: committed [RISC-V]: Harden test scan patterns To: Jeff Law Cc: Joern Rennecke , GCC Patches Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.3 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 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, Sep 27, 2023 at 1:14=E2=80=AFPM Jeff Law wr= ote: > > > > On 9/27/23 12:22, Joern Rennecke wrote: > > 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 ad= ded. > > > > 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 th= e > > 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 i= n > > '"' quotes, extra backslashes are needed. That is not necessary when i= t > > 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. > OK. So that naturally leads to the question, why aren't others seeing > this, both in the RISC-V world and more generally. I'm not aware of any > case where I've run the testsuite and tripped over this issue, nor am I > aware of anyone else tripping over it. I can answer the more generally part. Most other testcases if not all scan-assembler tries to add spaces that allow not to catch things out of place. Or even file/directory names. The documentation at https://gcc.gnu.org/onlinedocs/gccint/Final-Actions.html (and/or https://gcc.gnu.org/wiki/HowToPrepareATestcase) definitely could be expanded to make a mention of these gotchas really. Thanks, Andrew > > Jeff