[RFA]: Fix serious ultrasparc return bug (corrupted return value)

Stephane Carrez Stephane.Carrez@worldnet.fr
Fri Dec 7 13:57:00 GMT 2001


Hi!

Jakub Jelinek a écrit :
> 
> On Fri, Dec 07, 2001 at 03:26:01PM +0100, Stephane Carrez wrote:
> > I followed your recommendation and added a test that verifies both
> > cases.  I assume that `{ dg-do compile { target sparc*-*-* } }' is enough
> > not to break other test platforms.
> 
> Sorry for not writing this earlier.
> This is fine for -m32, but doesn't make the bug go away if -m64.
> For -m64, the test should be replaced with:
> 
>     case PLUS:
>       if (GET_CODE (XEXP (*where, 0)) == REG
>        && REGNO (XEXP (*where, 0)) == FRAME_POINTER_REGNUM
>        && (GET_CODE (XEXP (*where, 1)) != CONST_INT
>            || INTVAL (XEXP (*where, 1)) < SPARC_STACK_BIAS))
>      return 1;
>       break;
> 
> which unfortunately wouldn't handle reading from byte at virtual frame
> pointer - 2047 bytes if -O -mcpu=ultrasparc -m64:
> int baz ()
> {
>   char res[2059];
>   toto (&res);
>   return res[33];
> }
> 
> So e.g. additional
>     case MEM:
>       if (SPARC_STACK_BIAS
>           && GET_CODE (XEXP (*where, 0)) == REG
>           && REGNO (XEXP (*where, 0)) == FRAME_POINTER_REGNUM)
>         return 1;
>       break;
> should do the trick.
> 
> > 2001-12-07  Stephane Carrez  <Stephane.Carrez@sun.com>
> >
> >       * gcc.dg/sparc-ret.c: New file, test return corruption bug for
> >       ultrasparc.
> >
> >
> > 2001-12-07  Stephane Carrez  <Stephane.Carrez@sun.com>
> >
> >       * config/sparc/sparc.c (epilogue_renumber): Do not replace %fp
> >       with %sp because it can cause the delayed instruction to load
> >       below the stack.
> 
> Ok for mainline with the above changes, for branch it is Mark who has to
> approve it.
> 
>         Jakub

Thanks!  I committed on 3_1 with above changes (after test on solaris8, -m32/-m64).

	Stephane



More information about the Gcc-patches mailing list