From patchwork Sun Aug 30 20:41:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1354025 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=D1IbOpVP; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BflcV0Xp7z9sTF for ; Mon, 31 Aug 2020 06:41:46 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C0E73851C22; Sun, 30 Aug 2020 20:41:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C0E73851C22 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1598820103; bh=RNhgfIVOhynTgYS6IZ7a+NRlAJNanCCRrpXQdlvcoJM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=D1IbOpVPwanpFlsiswBaD3eEtoOrT4fj+T+lVLNaJKIL5SxIPnd9GLlBRcwdc+9YG eS7rCFmABgSgzyaxQgmNlhi5UaO4UX0G8qMdy/5AEouYKXxPclUR7wIyQ6LQ1jB/KQ smqnoz5mRQOuUNxmTNZsDsSh+Uw355JB0Kj+dzuU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by sourceware.org (Postfix) with ESMTPS id F023E3857831 for ; Sun, 30 Aug 2020 20:41:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F023E3857831 IronPort-SDR: Ee5LHhYh3TopFWTB1zthMuDkZRQGRF1xH6zQYix9a5y73UdTCaZwVjYZNimmQmKPQyGzKNbO8V nLpFX9B7cE5UFVsqd21CKozSU4izdrRG6ViYQmNAsEAxeK5BtGg6pA1SbcHltrN/LUJ75LiPRC WjJ2oQdXu1UlEt1Hw9TBYusv/hj6mb0c6lM2BFrmH3FCj8ntjoC0gdj3rN58L9iVBzlxWivrl8 29gnuRPOWiYuV2b4abg+kZeUNpD8NpztWUYaKsdrQZ0reE0+QeZx1qO2gCtL+/Nxr3MTlRJuPE QfI= X-IronPort-AV: E=Sophos;i="5.76,373,1592841600"; d="scan'208";a="146173139" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 Aug 2020 04:41:39 +0800 IronPort-SDR: YV9U4Ffen09v1D0lZSpl8tPgR97lXbKFkWKcuOMFz+nGFcEQCUR2WF1Eu3UmsrsBefGUXGMWne fKVpTrNCdkBw== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2020 13:29:08 -0700 IronPort-SDR: MUCfomYRXI7LGBsER4/JmntNErJKw6Hxi0XoZbgFkQIHitU3gxNcjN/lLw5fnR3AvFlbVdBSYM KdEZYh+U94QQ== WDCIronportException: Internal Received: from unknown (HELO redsun52) ([10.149.66.28]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2020 13:41:39 -0700 Date: Sun, 30 Aug 2020 21:41:31 +0100 (BST) To: libc-alpha@sourceware.org Subject: [PATCH] string: Fix GCC 11 `-Werror=stringop-overread' error Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-Patchwork-Original-From: "Maciej W. Rozycki via Libc-alpha" From: "Maciej W. Rozycki" Reply-To: "Maciej W. Rozycki" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Fix a compilation error: In function '__rawmemchr', inlined from '__rawmemchr' at rawmemchr.c:27:1: rawmemchr.c:36:12: error: 'memchr' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overread] 36 | return memchr (s, c, (size_t)-1); | ^~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors ../o-iterator.mk:9: recipe for target '.../string/rawmemchr.o' failed introduced with GCC 11 commit d14c547abd48 ("Add -Wstringop-overread for reading past the end by string functions."). --- string/rawmemchr.c | 2 ++ 1 file changed, 2 insertions(+) glibc-stringop-overread.diff Index: glibc/string/rawmemchr.c =================================================================== --- glibc.orig/string/rawmemchr.c +++ glibc/string/rawmemchr.c @@ -31,6 +31,8 @@ RAWMEMCHR (const void *s, int c) /* GCC 8 warns about the size passed to memchr being larger than PTRDIFF_MAX; the use of SIZE_MAX is deliberate here. */ DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-overflow="); + /* Likewise GCC 11, with a different warning option. */ + DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread"); #endif if (c != '\0') return memchr (s, c, (size_t)-1);