From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 0EFE23858D33 for ; Mon, 23 Jan 2023 11:45:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EFE23858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id A57EA302BBEC; Mon, 23 Jan 2023 12:45:27 +0100 (CET) Received: by r6.localdomain (Postfix, from userid 1000) id CD4FD340086; Mon, 23 Jan 2023 12:45:26 +0100 (CET) Message-ID: <9219e731c6989b64f339168494252cb613d2edd5.camel@klomp.org> Subject: Re: [PATCH] gdb: Ignore some stringop-overflow and restrict warnings on sparc From: Mark Wielaard To: gdb-patches@sourceware.org Cc: Sam James Date: Mon, 23 Jan 2023 12:45:26 +0100 In-Reply-To: <20230115005153.872624-1-mark@klomp.org> References: <20230115005153.872624-1-mark@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.2 (3.46.2-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-3036.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Sun, 2023-01-15 at 01:51 +0100, Mark Wielaard wrote: > For some reason g++ 12.2.1 on sparc produces a spurious warning for > stringop-overread and restruct in fsb-tdep.c for some memcpy calls. > Add new DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW and > DIAGNOSTIC_IGNORE_RESTRICT macro to suppress these warning. >=20 > include/ChangeLog: >=20 > * diagnostics.h (DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW): New > macro. > (DIAGNOSTIC_IGNORE_RESTRICT): Likewise. >=20 > gdb/ChangeLog: >=20 > * fsb-tdep.c (fbsd_make_note_desc): Use > DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW and > DIAGNOSTIC_IGNORE_RESTRICT on sparc. Ping. This is the last patch needed to build gdb on the new gentoo- sparc buildbot worker. > --- > gdb/fbsd-tdep.c | 10 ++++++++++ > include/diagnostics.h | 10 ++++++++++ > 2 files changed, 20 insertions(+) >=20 > diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c > index 203390d9880..ee2a4b54e85 100644 > --- a/gdb/fbsd-tdep.c > +++ b/gdb/fbsd-tdep.c > @@ -19,6 +19,7 @@ > =20 > #include "defs.h" > #include "auxv.h" > +#include "diagnostics.h" > #include "gdbcore.h" > #include "inferior.h" > #include "objfiles.h" > @@ -663,7 +664,16 @@ fbsd_make_note_desc (enum target_object object, uint= 32_t structsize) > =20 > gdb::byte_vector desc (sizeof (structsize) + buf->size ()); > memcpy (desc.data (), &structsize, sizeof (structsize)); > +#if defined (__sparc__) > + /* g++ 12.2.1 on sparc seems confused about the vector buf sizes. */ > + DIAGNOSTIC_PUSH > + DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW > + DIAGNOSTIC_IGNORE_RESTRICT > +#endif > memcpy (desc.data () + sizeof (structsize), buf->data (), buf->size ()= ); > +#if defined (__sparc__) > + DIAGNOSTIC_POP > +#endif > return desc; > } > =20 > diff --git a/include/diagnostics.h b/include/diagnostics.h > index d3ff27bc008..617943ae0d7 100644 > --- a/include/diagnostics.h > +++ b/include/diagnostics.h > @@ -94,6 +94,11 @@ > DIAGNOSTIC_IGNORE ("-Wstringop-overread") > #endif > =20 > +# if __GNUC__ >=3D 7 > +# define DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW \ > + DIAGNOSTIC_IGNORE ("-Wstringop-overflow") > +#endif > + > # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \ > DIAGNOSTIC_IGNORE ("-Wformat-nonliteral") > =20 > @@ -113,6 +118,7 @@ > # define DIAGNOSTIC_ERROR_SWITCH DIAGNOSTIC_ERROR ("-Wswitch") > # endif > =20 > +#define DIAGNOSTIC_IGNORE_RESTRICT DIAGNOSTIC_IGNORE ("-Wrestrict") > #endif > =20 > #ifndef DIAGNOSTIC_IGNORE_SELF_MOVE > @@ -139,6 +145,10 @@ > # define DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD > #endif > =20 > +#ifndef DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW > +# define DIAGNOSTIC_IGNORE_STRINGOP_OVERFLOW > +#endif > + > #ifndef DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL > # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL > #endif