This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: `__norestrict' type qualifier
"Jerry Quinn" <jquinn@nortelnetworks.com> writes:
|> Isn't the alignment precision a more general problem? If I understand what is
|> allowed by the standard (by following the recent threads) the following is
|> allowed to work correctly, because the incorrect pointer is only used to hold
|> the value and you then read it through a pointer of the correct type.
|>
|> short s = 5;
|> long *pl;
|> short *ps;
|> pl = &s;
|> ps = (short *)pl;
The second last line contains a constraint violation (assignment of
incompatible pointer types), so anything can happen. But if you add the
required cast then "ps == &s" must be true afterwards.
--
Andreas Schwab "And now for something
schwab@suse.de completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg