This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: XFAIL 20010122-1.c on MIPS



This test (which uses __builtin_return_address) is totally broken on
the MIPS.

Here are some examples of how we try to __builtin_return_address (0)
on MIPS, with -O0.

For 

  void *test1 (void)
  {
    void * temp;
    temp = __builtin_return_address (0);
    return temp;
  }

we do:

  	move	$3,$31
	lw	$2,0($3)
	sw	$2,16($fp)
	lw	$3,16($fp)
	move	$2,$3
	b	.L2
.L2:
	move	$sp,$fp
	ld	$fp,40($sp)
	ld	$28,32($sp)
	addu	$sp,$sp,48
	j	$31

That would appear to return the memory pointed to by the return
address, rather than the return address itself.

For

  void *test2 (void)
  {
    void * temp;
    dummy ();
    temp = __builtin_return_address (0);
    return temp;
  }

we do:

	  sd	$31,48($sp)
  .LCFI5:
	  sd	$fp,40($sp)
  .LCFI6:
	  sd	$28,32($sp)
  .LCFI7:
	  move	$fp,$sp
  .LCFI8:
	  .set	noat
	  lui	$1,%hi(%neg(%gp_rel(test2)))
	  addiu	$1,$1,%lo(%neg(%gp_rel(test2)))
	  daddu	$gp,$1,$25
	  .set	at
	  la	$25,dummy
	  jal	$31,$25
	  addu	$3,$fp,52
	  lw	$2,0($3)
	  sw	$2,16($fp)
	  lw	$3,16($fp)
	  move	$2,$3
	  b	.L3
  .L3:
	  move	$sp,$fp
	  ld	$31,48($sp)
	  ld	$fp,40($sp)
	  ld	$28,32($sp)
	  addu	$sp,$sp,64
	  j	$31

We store the return address at 48($sp), and then return the contents
of memory pointed to by 52($sp).  Hmm.

Fortunately, we were equally broken in GCC 2.95.2.  Gavin, would you
care to take a look at this, so that we can get it fixed for 3.1?

Tested on mips-sgi-irix6.5, installed on the branch.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

Mon May 14 20:26:20 2001  Mark P Mitchell  <mark@codesourcery.com>

	* gcc.c-torture/execute/20010122-1.x: XFAIL on MIPS.

Index: 20010122-1.x
===================================================================
RCS file: 20010122-1.x
diff -N 20010122-1.x
*** /dev/null	Tue May  5 13:32:27 1998
--- 20010122-1.x	Mon May 14 19:28:01 2001
***************
*** 0 ****
--- 1,2 ----
+ set torture_execute_xfail "mips-*-*"
+ return 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]