This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: type based aliasing again
- To: mark at codesourcery dot com (Mark Mitchell)
- Subject: Re: type based aliasing again
- From: Joe Buck <jbuck at synopsys dot COM>
- Date: Wed, 8 Sep 99 19:42:04 PDT
- Cc: jbuck at synopsys dot com, gcc at gcc dot gnu dot org, rms at gnu dot org
Sorry, I responded to Mark's message too quickly and didn't grasp
a key point.
> However, I do think this might be a good way to get useful warnings.
> So, I would amend your proposal to "issue a warning and then tell the
> compiler that there is no aliasing."
Sigh. If we can tell the user's intent, we should try to do the right thing.
If we're going to deliberately do the wrong thing, it would be best
to just issue a hard error. The compiler shouldn't go on to do something
that we know has a good chance of generating bogus code.
So we have three variants.
A). If we detect a rule violation, issue a warning and tell the compiler
to assume aliasing.
B). If we detect a rule violation, issue a warning and tell the compiler
to assume no aliasing. (That is, produce bad code).
C). If we detect a rule violation, issue an error and don't go on.
I think that only A) and C) are reasonable. B) is not. I would prefer
A).