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: gcc.c-torture/execute/frame-address.c


On Mon, Aug 29, 2005 at 10:56:05AM -0700, Richard Henderson wrote:
> > It does not have a frame because we sibling call optimize check_fa_work
> > which enables us not to have a frame pointer (or a stack pointer change)
> > in check_fa_mid.
> 
> Then we should find some way to prevent that.  Like returning different
> values from the functions.

I was thinking that a more direct way of ensuring a function had a frame
was to take the address of a local, but on further consideration I see
that isn't true.  In fact, powerpc64-linux allows 288 bytes below the
current stack pointer to be used as volatile storage not preserved
across function calls.  This space could be used for a local.

	* gcc.c-torture/execute/frame-address.c: Ensure function
	invoking __builtin_frame_address has a stack frame.

Index: gcc/testsuite/gcc.c-torture/execute/frame-address.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/frame-address.c,v
retrieving revision 1.1
diff -u -p -r1.1 frame-address.c
--- gcc/testsuite/gcc.c-torture/execute/frame-address.c	25 Aug 2005 11:30:19 -0000	1.1
+++ gcc/testsuite/gcc.c-torture/execute/frame-address.c	30 Aug 2005 00:57:43 -0000
@@ -17,7 +17,7 @@ int check_fa_mid (const char *c)
 {
   const char *f = __builtin_frame_address (0);
 
-  return check_fa_work (c, f);
+  return check_fa_work (c, f) != 0;
 }
 
 int check_fa (char *unused)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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