Re: RFC: RPM build flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.:
http://en.wikipedia.org/wiki/Aliasing_(computing)
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html
Searching for "strict aliasing" finds a lot more.

        Kevin Kofler

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux