This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: `__norestrict' type qualifier
Andreas Schwab wrote:
> I was wrong. If pl is not correctly aligned for a long then the behaviour
> is undefined.
>
> >From C9x, 6.3.2.3 Pointers
>
> [#7] A pointer to an object or incomplete type may be
> converted to a pointer to a different object or incomplete
> type. If the resulting pointer is not correctly aligned50)
> for the pointed-to type, the behavior is undefined.
> Otherwise, when converted back again, the result shall
> compare equal to the original pointer.
Thanks. That text's quite useful: it tells me the standard
distinguishes aligned pointers from unaligned pointers, and that
pointers to the wrong type of object already have semantics for the
aligned case but undefined behaviour for the unaligned case. You can't
dereference them but you can convert and then dereference them.
That's almost what we need to pin down the alignment semantics of
__norestrict. Unfortunately I don't have a copy of C9X -- is a
reasonably up to date one publicly available?
-- Jamie