public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* strict-aliasing and typedefs
@ 2003-05-14 20:56 Brad Lucier
  2003-05-14 21:07 ` Fergus Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Brad Lucier @ 2003-05-14 20:56 UTC (permalink / raw)
  To: gcc; +Cc: Brad Lucier

I've read the documentation and done a google and gcc search, but
I still have this question.

If I have the typedefs and variables

typedef int stackslot;
typedef int heapslot;

stackslot *sp;
heapslot *hp;

then can sp and hp point to the same location in memory with
ISO C's aliasing rules?  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.

Brad

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: strict-aliasing and typedefs
@ 2003-05-14 21:38 Robert Dewar
  0 siblings, 0 replies; 30+ messages in thread
From: Robert Dewar @ 2003-05-14 21:38 UTC (permalink / raw)
  To: gcc, lucier

> If I have the typedefs and variables
> 
> typedef int stackslot;
> typedef int heapslot;
> 
> stackslot *sp;
> heapslot *hp;
> 
> then can sp and hp point to the same location in memory with
> ISO C's aliasing rules?

Yes indeed. C is not Ada :-) There is only one int type, and giving it
different names does not make distinct types.

^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: strict-aliasing and typedefs
@ 2003-05-14 23:10 Robert Dewar
  2003-05-14 23:14 ` Joe Buck
  0 siblings, 1 reply; 30+ messages in thread
From: Robert Dewar @ 2003-05-14 23:10 UTC (permalink / raw)
  To: gdr, jbuck; +Cc: gcc, lucier

> Would that loss of performance be related to ABI issues (in single
> element case)? 

Right, for instance on SPARC, you have to pass even a one elemnt struct
by pointer (at least that's my understanding!)

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2004-02-24 10:29 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-14 20:56 strict-aliasing and typedefs Brad Lucier
2003-05-14 21:07 ` Fergus Henderson
2003-05-14 21:28   ` Gabriel Dos Reis
2003-05-14 21:08 ` Gabriel Dos Reis
2003-05-14 21:21   ` Joe Buck
2003-05-14 21:30     ` Gabriel Dos Reis
2003-05-14 21:41       ` Joe Buck
2003-05-14 21:53         ` Gabriel Dos Reis
2003-05-14 22:17         ` Gabriel Dos Reis
2003-05-14 22:29           ` two-element struct performance (was: strict-aliasing and typedefs) Joe Buck
2003-05-14 22:49             ` Gabriel Dos Reis
2003-05-14 23:06               ` Joe Buck
2004-02-20  0:43             ` law
2004-02-20  9:06               ` Richard Henderson
2004-02-20 15:21                 ` law
2004-02-24  6:19                 ` law
2004-02-24 10:29                   ` Gabriel Dos Reis
2004-02-24 10:44                     ` Paolo Carlini
2003-05-14 21:21 ` strict-aliasing and typedefs Andreas Schwab
2003-05-14 21:32   ` Gabriel Dos Reis
2003-05-14 21:46     ` Brad Lucier
2003-05-14 21:56       ` Gabriel Dos Reis
2003-05-14 21:47     ` Daniel Jacobowitz
2003-05-14 21:59       ` Gabriel Dos Reis
2003-05-14 22:04         ` Daniel Jacobowitz
2003-05-14 22:07           ` Brad Lucier
2003-05-14 22:11             ` Gabriel Dos Reis
2003-05-14 21:38 Robert Dewar
2003-05-14 23:10 Robert Dewar
2003-05-14 23:14 ` Joe Buck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).