This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strict-aliasing and typedefs


Joe Buck <jbuck@synopsys.com> writes:

| Brad Lucier <lucier@math.purdue.edu> writes:
| > |  I'm wondering if a Scheme->C compiler
| > | can use typedefs and ISO C's aliasing rules to tell gcc that certain
| > | memory locations cannot alias each other.
|  
| On Wed, May 14, 2003 at 11:08:27PM +0200, Gabriel Dos Reis wrote:
| > No, a typedef does not introduce a distinct type:  It just introduces a
| > new type-name -- it is all syntactical.
| 
| How about one-element structs (with same layout but distinct names)?  Those
| can't alias.

Yes, that will work but then, as Fergus pointed out, GCC seems to very
fragile when it comes to optimize "simple" structures.  

I would use "restrict" here.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]