From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TN8XB1dGVWNjvQ8AWB0awg (envelope-from ) for ; Sun, 23 Oct 2022 09:49:11 -0400 Received: by simark.ca (Postfix, from userid 112) id 13E481E112; Sun, 23 Oct 2022 09:49:11 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=BFiK81bU; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4BB0A1E0D3 for ; Sun, 23 Oct 2022 09:49:10 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C5D973851A98 for ; Sun, 23 Oct 2022 13:49:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5D973851A98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666532949; bh=hPNVZSXz1tmwd10vsvxkleq99pGr9cZJhm6Bxy+12YM=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=BFiK81bUFFhVNdnDYFoyeZVr0ougNI4Noj3tTLw8dTbu6eqycllv79/i7YbT84Hxa qty1CeYZmJNKH6fUdLkJErsSX0z5zNnzzPI4JJCKMdKPiFv0JOsRJQ0dHKnruqgdVd D5gO41GEpGjeCAlcyzdpJffKFoDKVWw1BSRIjMgs= Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 8E5673851C21 for ; Sun, 23 Oct 2022 13:48:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E5673851C21 Received: by smtp.gentoo.org (Postfix, from userid 559) id 2D4E9341084; Sun, 23 Oct 2022 13:48:49 +0000 (UTC) Date: Sun, 23 Oct 2022 18:19:23 +0545 To: Andrew Burgess Subject: Re: [PATCH 4/5] sim/erc32: avoid dereferencing type-punned pointer warnings Message-ID: Mail-Followup-To: Andrew Burgess , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TcijPd03MczgHlFS" Content-Disposition: inline In-Reply-To: X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --TcijPd03MczgHlFS Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 12 Oct 2022 13:38, Andrew Burgess via Gdb-patches wrote: > When building the erc32 simulator I get a few warnings like this: >=20 > /tmp/build/sim/../../src/sim/erc32/exec.c:1377:21: warning: dereferenci= ng type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] > 1377 | sregs->fs[rd] =3D *((float32 *) & ddata[0]); > | ~^~~~~~~~~~~~~~~~~~~~~~~ >=20 > The type of '& ddata[0]' will be 'uint32_t *', which is what triggers > the warning. >=20 > This commit uses an intermediate pointer of type 'char *' when > performing the type-punning, which is well-defined behaviour, and will > silence the above warning. this is kind of a poor fix. if we can't arrange for the pointers to be the right type, at least a memcpy would be better. -mike --TcijPd03MczgHlFS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNVNM8ACgkQQWM7n+g3 9YG1xw//RTQFmE4zVNPyzfZ3TFt2Tk71NxQ4VctDPiKF5Lj5iXxWMDsNEeV4BSU3 GyJTc2PR3Fr1RkfL2t6hiIZnoB3EMjtlf6kNQVuAv8HDbumjuAuO4w2Oe5JmIHUA VcdOAPHWr6xm5VQz6gluXQ2pejgt3khUOv6YTsF49EQ7q1Ls7FxoNapz1gR88XCZ BS6zkcVzS2IWxXDYm5cJrfbJBUUGPoUcOJgGgMC56+np9en9wKg7VeHAhJZDKkDi XDkd0N6qqry2sX1e/CSfXzWaS+PrOl+kP7Z+miAeqIgxbUMv5FDIbcSmNtsm4Ex8 GGOWRgp47Cfy/5sg28YCS7T0Z5j89vmCDbYfnT9GRYhh+kPODDd8VsGI1Pmf0sZ/ W9498+MG89aMNZinnCV6WcgycoKxUMKUmzu/vL5EJCUuPaQZB41L0rIMSOFmAxAO 1ByTAzyP/+jTnEipOXfHMkVr1PpA3Q6nGTX3JArfEQ5xA6Ph1kvIEcTg0nOFKaHe Qfy219fixE64L+D1+zcu+KBPtmr8mxa//vZGLgXwK683mdounUihMO5r30uKLo+s 9Axu4xBn825bajLL7fd1zb3//abGF/W2UuExzBG//Qg7nFEWxD2Wpfe1dDyKtK+X NkBST05pPEpkzWq55eo2ewxLNtDucGIpA6KY7msm1yXA521LGF8= =Z5Zn -----END PGP SIGNATURE----- --TcijPd03MczgHlFS--