From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Sat, 20 Aug 2011 15:41:36 -0400 Subject: [U-Boot] [PATCH 1/2 V2] USB: Fix complaints about strict aliasing in OHCI-HCD In-Reply-To: <201108202132.56067.marek.vasut@gmail.com> References: <1313867713-20949-1-git-send-email-marek.vasut@gmail.com> <201108201529.07254.vapier@gentoo.org> <201108202132.56067.marek.vasut@gmail.com> Message-ID: <201108201541.37522.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Saturday, August 20, 2011 15:32:55 Marek Vasut wrote: > On Saturday, August 20, 2011 09:29:06 PM Mike Frysinger wrote: > > On Saturday, August 20, 2011 15:15:12 Marek Vasut wrote: > > > __u32 datab[4]; > > > > > > - __u8 *data_buf = (__u8 *)datab; > > > + union { > > > + void *ptr; > > > + __u8 *u8; > > > + __u16 *u16; > > > + __u32 *u32; > > > + } databuf; > > > > > > + databuf.u32 = (__u32 *)datab; > > > > i'm not sure this is correct, but i'm not really an expert on aliasing > > behavior. i think the union should sit on top of the storage, and not > > hide the pointer casts. > > And endianity comes into play here too ... that's where my brain started > chugging a bit too. That's why I'd like to see other's opinion on this. endianness isn't an issue between the union-of-pointers and union-of-storage. in both cases, you start at the same base address. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20110820/d2975c7b/attachment.pgp