This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Clarification anyone? -- was Re: Linux and aliasing?
- To: george at moberg dot com
- Subject: Re: Clarification anyone? -- was Re: Linux and aliasing?
- From: mark at codesourcery dot com
- Date: Tue, 08 Jun 1999 10:23:56 -0700
- Cc: egcs at egcs dot cygnus dot com
- Organization: CodeSourcery, LLC
- References: <XFMail.990608094539.george@moberg.com>
>>>>> "george" == george <george@moberg.com> writes:
george> I've been following this thread from the beginning, but I
george> don't have the ANSI/ISO standard for C, and I'd like to
george> know more about what kind of code is conformant and what
george> isn't.
It's pretty simple: you may only access something of type X through an
lvalue of type X (i.e., a pointer of type X*, or a variable of type X,
or some such.) The exceptions are that you may access *anything*
though a pointer of type `char*', and that you may use a `const X*' to
access a non-const X, or an `X*' to access a `const X' (similarly for
volatile). Also, you can use `signed int*' to access an `unsigned
int'; similarly for other integer types.
george> This whole thing seems a little scary--I'm using egcs
george> 1.1.2 on a large project and I'd be afraid to upgrade
george> without a clear understanding of this particular issue
george> and/or a clear warning from the compiler when I violate
george> the aliasing rules, whether I violate them on purpose or
george> by accident.
Just turn on -fno-strict-aliasing; that's the same behavior you know
and love.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com