http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51628



incrediball <peter at axium dot co.nz> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |peter at axium dot co.nz



--- Comment #15 from incrediball <peter at axium dot co.nz> 2013-04-02 00:58:40 
UTC ---

I believe the discussion here is missing the point. Currently (at least with

version 4.5 and ARM, which I am currently using) the situation is that the

compiler generates broken code WITHOUT COMMENT when the address of something

like an integer in a packed structure is assigned to a int* . Since the pointer

type does not provide any information about the actual alignment of the

integer, it is obviously impractical to fix when accessing the integer and we

certainly do not want to have extra code inserted for handling the possibility

that the int may not be aligned correctly. Therefore the compiler MUST see this

as a type conflict and at least warn that the address of the member in a packed

struct is incompatible with the pointer type.



I have several projects which require the use of packed structures and I simply

cannot rule out that that I have not at some point accidentally assigned the

address of a member variable to a pointer. It would therefore be very handy if

the compiler could point this out. -Wcast-align certainly doesn't do this.

Reply via email to