RFC: RPM build flags
kevin.kofler at chello.at
Tue Feb 17 13:04:55 UTC 2009
Richard W.M. Jones wrote:
> I think I agree with you. I spent a long time looking at the strict
> aliasing warnings generated by GCC for rpcgen-generated code. I
> couldn't find a good explanation anywhere for what the problems are
> with the code and what sort of bugs the compiler could introduce. For
> example, making apparently simple and semantics-preserving changes to
> the code made the warning go away, but did that make the bug go away?
> (serious question -- I've no idea).
In short, you cannot access a variable of type A through a pointer of type
B. For example, if x is of type double, it is invalid to use *(int*)&x to
get at the double's bits.
Some aliasing warnings are also caused by sloppy use of types, e.g. using
int instead of long or size_t. (E.g. using int * when the data pointed to
is actually of type size_t.) That sort of abuse can also cause breakage on
64-bit platforms, so in those cases the code needs to be fixed to use the
correct type anyway.
> Does such a reference exist to help us understand the problem?
Plenty thereof, see e.g.:
Searching for "strict aliasing" finds a lot more.
More information about the devel