This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: strict-aliasing and typedefs
Joe Buck <jbuck@synopsys.com> writes:
> | How about one-element structs (with same layout but distinct names)? Those
> | can't alias.
On Wed, May 14, 2003 at 11:30:15PM +0200, Gabriel Dos Reis wrote:
> Yes, that will work but then, as Fergus pointed out, GCC seems to very
> fragile when it comes to optimize "simple" structures.
GCC does a decent job with one-element structs; its performance quickly drops like
a rock as soon as there are two elements. Still, there may well be some loss from
using it.
> I would use "restrict" here.
"restrict" says that nothing at all aliases with some object. What if you have
two pointers to Fred and two pointers to Barney? "restrict" cannot express the
aliasing relationship.