This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to supress a specific kind of ansi-aliasing rules?
On Wed, 20 Jun 2007, Daniel Jacobowitz wrote:
> On Wed, Jun 20, 2007 at 09:26:39AM -0400, Diego Novillo wrote:
> > Having said that, maybe we could consider having CSE not doing this with
> > -fno-strict-aliasing, but I'm not sure if it's a good idea. What do
> > others think?
>
> I haven't seen a useful reason in this thread why you would want to do
> so; and I don't think it has anything to do with aliasing, so it
> shouldn't be grouped there.
We don't document what the -fstrict-aliasing dialect is. I think the
current version is
- like standard C or C++ but without the type-based alias rules
and the version desired by the original poster is
- each toplevel object (declared or allocated) is a block of bytes, and
arbitrary pointer arithmetic can be used within that block and any part of
it accessed with any type, as long as pointers remain properly aligned and
you don't go outside the original object.
If you eliminate the type-based alias rules, the only thing stopping the
rules from being the second version is probably that most conversions
between pointer types don't have specified semantics. Both versions may
well be useful.
--
Joseph S. Myers
joseph@codesourcery.com