egcs-current: Major optimizer bug
Jeffrey A Law
law@cygnus.com
Tue Jun 30 23:56:00 GMT 1998
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
More information about the Gcc-bugs
mailing list