From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ben Warren Date: Mon, 20 Jul 2009 21:49:42 -0700 Subject: [U-Boot] [PATCH v2] net: tsec - fix dereferencing type-punned pointer will break strict-aliasing rules warning In-Reply-To: <20090717121700.9c3f1e56.kim.phillips@freescale.com> References: <20090615115033.94ba02d2.kim.phillips@freescale.com> <4A39CD34.4070108@gmail.com> <2acbd3e40906181519h8c14828pf167c0c197a6e828@mail.gmail.com> <4A56D89D.2040900@gmail.com> <20090717121700.9c3f1e56.kim.phillips@freescale.com> Message-ID: <4A6548E6.3080909@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Kim, Kim Phillips wrote: > fix this gcc 4.4 warning: > > tsec.c: In function 'tsec_init': > tsec.c:200: warning: dereferencing type-punned pointer will break strict-aliasing rules > > Signed-off-by: Kim Phillips > --- > this is the endian-correct version > > drivers/net/tsec.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c > index 63fc02e..5dc05e5 100644 > --- a/drivers/net/tsec.c > +++ b/drivers/net/tsec.c > @@ -197,7 +197,10 @@ int tsec_init(struct eth_device *dev, bd_t * bd) > for (i = 0; i < MAC_ADDR_LEN; i++) { > tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->enetaddr[i]; > } > - regs->macstnaddr1 = *((uint *) (tmpbuf)); > + tempval = (tmpbuf[0] << 24) | (tmpbuf[1] << 16) | (tmpbuf[2] << 8) | > + tmpbuf[3]; > + > + regs->macstnaddr1 = tempval; > > tempval = *((uint *) (tmpbuf + 4)); > > Applied to net repo. thanks, Ben