From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by sourceware.org (Postfix) with ESMTPS id 9786D384BC11 for ; Fri, 9 Jul 2021 13:18:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9786D384BC11 Received: by mail-lf1-x132.google.com with SMTP id x25so10448202lfu.13 for ; Fri, 09 Jul 2021 06:18:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=Fgo6RfWsljAdYa8YfDPZ+095yYA4TIyM05ycEJPLA+g=; b=SFKRmRRtf0sASYKCDSSc7FVrCkclEvc+2QvGUKumWnejS21m2W5g5skkY9HmfVmiV8 1M5u+EjZdHgKiQ17o5wRksr4DeYIkzsUlm6eAm2VHQqcqFtexCxJo3mWC3VsLwyT/VC4 3K5aAm4lRqFolCvnqIuqKH5NtD5mZIytY/pR58qIN+V94L8pSbMc91BE3f2xnFWLETIQ FV0gODOeyzLF8Qf3ZDAMa6B6weduLa7aX/SxxqJW2weN3K7+DgI1s0sK/42/hpbCFCkn kBaOzZNSTUQLInuvfA1go1FcTvyKNpsI71bsi49AEqa9NCmX7lEoPt9Pol9yUoiKUo8K q1Lw== X-Gm-Message-State: AOAM531T3n0HjzbKrX/XPffSukLJOCfWZZFclDWI4M2l3AipZm9gEXCq GOUHmgide/E1RhiGV1o9Lz03 X-Google-Smtp-Source: ABdhPJysbliokg+A3AO6eI17fwC1AAcbBBnw7GUNEUh+srbqhIFFSCH1r9KnaYhcfhLvCAS2MHapbg== X-Received: by 2002:ac2:48a3:: with SMTP id u3mr12655481lfg.38.1625836685272; Fri, 09 Jul 2021 06:18:05 -0700 (PDT) Received: from [192.168.0.218] ([185.30.228.145]) by smtp.gmail.com with ESMTPSA id u3sm464834lft.236.2021.07.09.06.18.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jul 2021 06:18:04 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: disable -Warray-bounds in libgo (PR 101374) From: Maxim Kuvyrkov In-Reply-To: Date: Fri, 9 Jul 2021 16:19:14 +0300 Cc: Richard Biener , gcc-patches , Ian Lance Taylor , Richard Henderson Content-Transfer-Encoding: quoted-printable Message-Id: <9F56A005-47B2-4593-BCB4-B8FAD3533955@linaro.org> References: To: Martin Sebor X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:18:10 -0000 > On 9 Jul 2021, at 09:16, Richard Biener via Gcc-patches = wrote: >=20 > On Thu, Jul 8, 2021 at 8:02 PM Martin Sebor via Gcc-patches > wrote: >>=20 >> Hi Ian, >>=20 >> Yesterday's enhancement to -Warray-bounds has exposed a couple of >> issues in libgo where the code writes into an invalid constant >> address that the warning is designed to flag. >>=20 >> On the assumption that those invalid addresses are deliberate, >> the attached patch suppresses these instances by using #pragma >> GCC diagnostic but I don't think I'm supposed to commit it (at >> least Git won't let me). To avoid Go bootstrap failures please >> either apply the patch or otherwise suppress the warning (e.g., >> by using a volatile pointer temporary). >=20 > Btw, I don't think we should diagnose things like >=20 > *(int*)0x21 =3D 0x21; >=20 > when somebody literally writes that he'll be just annoyed by = diagnostics. And we have an assortment of similar cases in 32-bit ARM kernel-page = helpers. At the moment building libatomic for arm-linux-gnueabihf fails with: =3D=3D=3D In function =E2=80=98select_test_and_set_8=E2=80=99, inlined from =E2=80=98select_test_and_set_8=E2=80=99 at = /home/tcwg-buildslave/workspace/tcwg-dev-build/snapshots/gcc.git~master/li= batomic/tas_n.c:115:1: = /home/tcwg-buildslave/workspace/tcwg-dev-build/snapshots/gcc.git~master/li= batomic/config/linux/arm/host-config.h:42:34: error: array subscript 0 = is outside array bounds of =E2=80=98unsigned int[0]=E2=80=99 = [-Werror=3Darray-bounds] 42 | #define __kernel_helper_version (*(unsigned int *)0xffff0ffc) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ =3D=3D=3D In libatomic/config/linux/arm/host-config.h we have: =3D=3D=3D /* Kernel helper for 32-bit compare-and-exchange. */ typedef int (__kernel_cmpxchg_t) (UWORD oldval, UWORD newval, UWORD = *ptr); #define __kernel_cmpxchg (*(__kernel_cmpxchg_t *) 0xffff0fc0) /* Kernel helper for 64-bit compare-and-exchange. */ typedef int (__kernel_cmpxchg64_t) (const U_8 * oldval, const U_8 * = newval, U_8 *ptr); #define __kernel_cmpxchg64 (*(__kernel_cmpxchg64_t *) 0xffff0f60) /* Kernel helper for memory barrier. */ typedef void (__kernel_dmb_t) (void); #define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0) /* Kernel helper page version number. */ #define __kernel_helper_version (*(unsigned int *)0xffff0ffc) =3D=3D=3D -- Maxim Kuvyrkov https://www.linaro.org