This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-current: Major optimizer bug
- To: "Matthias Urlichs" <smurf at noris dot de>
- Subject: Re: egcs-current: Major optimizer bug
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 01 Jul 1998 00:52:33 -0600
- cc: egcs-bugs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <19980630114738.H30376@noris.de>you write:
> egcs-2.91.45 19980628 (gcc2 ss-980609 experimental) severely miscompiles
> the following, quite simple, code:
>
> >>>>>>>>>>>>>>>>
> int dn_skipname(unsigned char *ptr, unsigned char *eom) {
> unsigned char *saveptr = ptr;
>
> if (ns_name_skip(&ptr, eom) == -1)
> return (-1);
> return (ptr - saveptr);
> }
> >>>>>>>>>>>>>>>>
>
> The resulting assembly output (i386) looks like the following. As you can
> see, it will always return zero, which is not at all what's intended. :-(
Thanks. Initial analysis indicates that it's a problem with the
ADDRESSOF optimizations. It looks like we've got an invalid REG_EQUIV
note for a load of the stack slot contining "ptr". The REG_EQUIV
note causes later optimizations to optimize away the load of
the slot after the call to ns_name_skip.
I've added this test to the testsuite.
Thanks,
jeff