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]
Other format: [Raw text]

Re: RFA: fix an aliasing problem in cygwin prologues


Richard Henderson <rth@redhat.com> writes:
>> +   char buf[0x10000];
>
> I think there's some dejagnu-controled define that's set for 
> targets with small stacks.  This test case is likely to fail
> for them.

Oops, good catch.  For the record, here's what I installed.
I checked that the testcase uses the dummy main() on h8300-elf
and uses the normal main() on i686-pc-linux-gnu.

Richard


	* config/i386/i386.c (ix86_expand_prologue): If the function uses a
	frame pointer, restore eax with an ebp-relative address.

Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.702
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.702 i386.c
*** config/i386/i386.c	27 Jul 2004 21:41:19 -0000	1.702
--- config/i386/i386.c	5 Aug 2004 07:09:19 -0000
*************** ix86_expand_prologue (void)
*** 5399,5405 ****
  
        if (eax_live)
  	{
! 	  rtx t = plus_constant (stack_pointer_rtx, allocate);
  	  emit_move_insn (eax, gen_rtx_MEM (SImode, t));
  	}
      }
--- 5399,5412 ----
  
        if (eax_live)
  	{
! 	  rtx t;
! 	  if (frame_pointer_needed)
! 	    t = plus_constant (hard_frame_pointer_rtx,
! 			       allocate
! 			       - frame.to_allocate
! 			       - frame.nregs * UNITS_PER_WORD);
! 	  else
! 	    t = plus_constant (stack_pointer_rtx, allocate);
  	  emit_move_insn (eax, gen_rtx_MEM (SImode, t));
  	}
      }
*** /dev/null	Fri Apr 23 00:21:55 2004
--- testsuite/gcc.c-torture/execute/20040805-1.c	Thu Aug  5 08:08:31 2004
***************
*** 0 ****
--- 1,31 ----
+ #if __INT_MAX__ < 32768 || (defined(STACK_SIZE) && STACK_SIZE < 0x12000)
+ int main () { exit (0); }
+ #else
+ int a[2] = { 2, 3 };
+ 
+ static int __attribute__((noinline))
+ bar (int x, void *b)
+ {
+   a[0]++;
+   return x;
+ }
+ 
+ static int __attribute__((noinline))
+ foo (int x)
+ {
+   char buf[0x10000];
+   int y = a[0];
+   a[1] = y;
+   x = bar (x, buf);
+   y = bar (y, buf);
+   return x + y;
+ }
+ 
+ int
+ main ()
+ {
+   if (foo (100) != 102)
+     abort ();
+   exit (0);
+ }
+ #endif


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