This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA]: Fix serious ultrasparc return bug (corrupted return value)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Stephane Carrez <Stephane dot Carrez at Sun dot COM>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 7 Dec 2001 10:22:29 -0500
- Subject: Re: [RFA]: Fix serious ultrasparc return bug (corrupted return value)
- References: <200112071426.PAA16796@sunchorus.France.Sun.COM>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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