From: Andreas Schwab <schwab@suse.de>
To: Brad Lucier <lucier@math.purdue.edu>
Cc: gcc@gcc.gnu.org
Subject: Re: strict-aliasing and typedefs
Date: Wed, 14 May 2003 21:21:00 -0000 [thread overview]
Message-ID: <jed6ilb4xo.fsf@sykes.suse.de> (raw)
In-Reply-To: <200305142056.h4EKujuX025820@banach.math.purdue.edu> (Brad Lucier's message of "Wed, 14 May 2003 15:56:45 -0500 (EST)")
Brad Lucier <lucier@math.purdue.edu> writes:
|> 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?
Yes. Typedefs don't introduce new types, just new names. The following
is completely equivalent:
typedef int stackslot;
typedef int heapslot;
int *sp;
int *hp;
|> 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.
One way to do this is to define differently named structures with a single
member, but they may pessimize the generated code due to ABI
peculiarities.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2003-05-14 21:21 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-14 20:56 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 ` Andreas Schwab [this message]
2003-05-14 21:32 ` strict-aliasing and typedefs 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jed6ilb4xo.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=gcc@gcc.gnu.org \
--cc=lucier@math.purdue.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).