From: Wolfgang Denk Date: Thu, 07 Oct 2010 21:31:43 +0200 Subject: [U-Boot] packed attribute problem In-Reply-To: <20101007135257.05a93975@udp111988uds.am.freescale.net> References: <4CA9A095.9000900@st.com> <20101004101714.A19931539A0@gemini.denx.de> <4CA9ACAA.2020001@st.com> <20101004104443.09AE41539A0@gemini.denx.de> <4CA9B2DA.6030407@emk-elektronik.de> <4CA9B3EF.7000704@st.com> <4CA9BE94.6000401@emk-elektronik.de> <20101004122900.A090B1539A0@gemini.denx.de> <4CA9CC04.5020800@emk-elektronik.de> <20101005130359.432f7038@udp111988uds.am.freescale.net> <20101007114634.70e0f197@udp111988uds.am.freescale.net> <20101007175701.1C4B31539A0@gemini.denx.de> <20101007135257.05a93975@udp111988uds.am.freescale.net> Message-ID: <20101007193143.19030153A7E@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Scott Wood, In message <20101007135257.05a93975@udp111988uds.am.freescale.net> you wrote: > > > It is a pretty common method to use a pointer to some struct (for > > example, some form of PDU) and make it point to some I/O buffer. > > Yes, but at that point we are not talking about well-defined C, but > rather implementation-specific behavior. There's nothing wrong with > it, but the C standard is no longer authoritative on what happens in > such cases. Huch? Which part of that is not well-defined (or even not standard-conforming) C? > Yes. And there would also be performance complaints if each of those > accesses were to trap and be emulated (even ignoring weird stuff like > old ARM). Thus it's nice to have some sort of pointer or data type > annotation to tell the compiler to be careful. I also complain about poor performance when instead of a single instruction (a 32 bit load) at least 4 (8 bit) instructions need to be executed. > BTW, I see GCC splitting accesses to bitfields in a packed > struct into bytes on powerpc, even with -mno-strict-align. Indeed. Bitfields have always been evil. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "And it should be the law: If you use the word `paradigm' without knowing what the dictionary says it means, you go to jail. No exceptions." - David Jones @ Megatest Corporation