Proposed resolution to aliasing issue.
Mark Mitchell
mark@codesourcery.com
Tue May 17 23:16:00 GMT 2005
Mike Stump wrote:
> We need to teach it about the meaning of constants.
>
> One can:
>
> #include "foo.h"
>
> main() {
> printf ("%d\n", offsetof (s, m));
> }
>
> and then in another file, read and use that on an address. One can
> also transform it into a #define S_M_OFFSET 8, and #include it. So,
> I'd claim the optimizer has to know about constants already.
I fail to see your point, unless it is that whether or not you spell "8"
as "8", "&s.x - &s.y", or "offsetof (S, x) - offsetof (S, y)" should not
matter, in which case I certainly agree.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
More information about the Gcc
mailing list