[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: pthreadP.h stack growth/allocation assumption



On Mon, Mar 17, 2003 at 05:23:52PM +1100, Ian Wienand wrote:
> Hello,
> 
> In pthreadP.h there is
> 
> # define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other)
> 
> which seems to assume that things allocated on the stack will be
> allocated downwards if the stack grows downwards.  This doesn't happen
> on IA64.  

Not true, IA64 has the stack growing downwards. The problem is that
within one routine, the compiler may allocate local variables in any order
it chooses, so if there are more pthread_cleanup_push macros in one routine,
it may fail.
Should be fixed by Paul's patch:
-  if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev))
+  if (buffer->__prev != NULL
+      && FRAME_LEFT (CURRENT_STACK_FRAME, buffer->__prev))
     buffer->__prev = NULL;
in cleanup.c.

	Jakub





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]