This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: module level flags
On Sat, Sep 28, 2002 at 05:00:34PM -0700, Bruce Korb wrote:
> Zack Weinberg wrote:
> >
> > On Sat, Sep 28, 2002 at 04:46:21PM -0700, Bruce Korb wrote:
>
> > If you've found an optimizer bug in 3.[12] not present in 3.0 and
> > prior, you could have the courtesy to *tell us what it is* so we can
> > *fix* it.
>
> OK: :-) Meanwhile, I have determined it was caused by failing
> to recognize a valid alias.
I'm afraid the compiler is working as designed.
> YYSTYPE def,
> YYSTYPE list )
> {
> + tDefEntry* ret = (tDefEntry*)list;
> tDefEntry* pDef = (tDefEntry*)def;
> - tDefEntry* pScn = (tDefEntry*)list;
> - tDefEntry** ppT = (tDefEntry**)&list;
> + tDefEntry* pScn = ret;
> + tDefEntry** ppT = &ret;
In the original code, the type-based aliasing rules permit the
compiler to assume that assignment to ppT does not modify list
EVEN THOUGH IT IS OBVIOUS TO A HUMAN THAT IT DOES.
Your fix is the right way to correct your code. By immediately
assigning list to a temporary with its true type, you show the
compiler what's really going on.
zw