This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: strict-aliasing and typedefs
- From: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- To: Brad Lucier <lucier at math dot purdue dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 15 May 2003 07:07:27 +1000
- Subject: Re: strict-aliasing and typedefs
- References: <200305142056.h4EKujuX025820@banach.math.purdue.edu>
On 14-May-2003, Brad Lucier <lucier@math.purdue.edu> wrote:
> 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.
> 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.
I don't think so.
You might be able to do it using single-member structs instead of typedefs;
but doing that might inhibit some of GCC's other optimizations.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.