From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 997253858C60 for ; Mon, 10 Jan 2022 18:40:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 997253858C60 Received: by mail-pl1-x629.google.com with SMTP id p14so13266871plf.3 for ; Mon, 10 Jan 2022 10:40:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LWxOGrhxARL4MaShV4xfP4csYJjqGGdse8Wma4FD5gY=; b=JkR7hDaecsoUTftHyZ8Lu7KWS/llF57vsIR0IovkgRn9DyKknstmQpqX8JK/Tyh41m 9Y21feggVyLlcvT2b5gOKyiLhFKAIuwGSi6rQBF6B2rnmR5QimkCowOSLKcoSc4n78ud tuvsl1ENDYvsgG8pbTZgrIznTZri4pDl8IMpgSOomhAex5FWwj2I4qrJjC0vK43mCz97 IQwzP4/oQU+O8jJA5wXqkdwaKlMe30NleIsmhJkaqHC6LEmmWaHU1jEleqPg6hWR2oil lo8mIo3t3uhrnbtt+EDNhl+K1AmdZ/v5W4VC6EIJtlkKV25dtzMKGkUyetVN88jvStOQ ocvg== X-Gm-Message-State: AOAM532sY4i9Z4+WsENDuRhu8xrZn/Er/JYbUjJaygGHzROncFV9bo50 FjhPaOFoG4tANmsx7oTJkkfE84YgKqtpdFJ7LUo1e3Ze X-Google-Smtp-Source: ABdhPJwsYWdpkL7SgUHMugQgMueItgbPMxBZqDU83BzZkhshWKiVj6eDT+Dkh37kkukV3uUzsIPFZ9VoUAA0NCuTtpo= X-Received: by 2002:a17:903:2486:b0:149:1ce1:d45d with SMTP id p6-20020a170903248600b001491ce1d45dmr903882plw.57.1641840007657; Mon, 10 Jan 2022 10:40:07 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Noah Goldstein Date: Mon, 10 Jan 2022 12:39:56 -0600 Message-ID: Subject: Re: [PATCH v2 3/7] string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp]. To: Wilco Dijkstra Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Jan 2022 18:40:09 -0000 On Mon, Jan 10, 2022 at 5:42 AM Wilco Dijkstra wrote: > > Hi Noah, > > > These implementations are incorrect. There may be a mismatch in s1/s2 > > before invalid memory but no null CHAR / length boundary. > > This is not true, see eg. https://en.cppreference.com/w/cpp/string/byte/strcmp. > Most string functions require that the string is correctly terminated. There > are only a few exceptions (memchr IIRC), and several generic implementations > use strlen or strnlen before the main loop. > > So if your changes to the testsuite cause these functions to fail, I believe it will > create failures on other targets too (eg. AArch64 strcmp does a check for zero > and continues reading if there is no zero). > > It's OK to remove these weirdly named functions (I already removed them from > the benchtests directory), however we should ensure the strings are valid to > avoid reporting errors on existing implementations. Good catch! Had always thought the per-byte loop that stopped on mismatch was the functionality we had to emulate. I'll update the commit message in V3 and make sure all the added tests don't test this edge case. > > Cheers, > Wilco