This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix PR boehm-gc/33442
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Oct 2007 20:52:58 -0400 (EDT)
- Subject: [committed] Fix PR boehm-gc/33442
The enclosed patch fixes PR boehm-gc/33442. This is a regression
on hppa-*-linux-gnu exposed by corrections to the stack allocation
on STACK_GROWS_UP targets using NPTL threads. This caused garbage
collection in java applications to break across the board.
The POSIX specification and SUSV3 state that the stack address
returned by pthread_attr_getstack is the base (lowest addressable
byte) of the storage created for a thread's stack. Thus, it is
incorrect to subtract the size of this storage on STACK_GROWS_UP
targets to calculate the stack base address.
Hans Boehm indicated that this problem is fixed upstream in gc7.
Tested on hppa-unknown-linux-gnu (debian lenny). Committed as
obvious to the trunk. Will commit to branches in a few days if
no problems are reported.
Thanks to Carlos O'Donell for help in resolving this issue.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2007-10-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR boehm-gc/33442
* pthread_support.c (GC_PTR GC_get_thread_stack_base): If stack grows
up, return stack_addr instead of stack_addr - stack_size.
Index: pthread_support.c
===================================================================
--- pthread_support.c (revision 129140)
+++ pthread_support.c (working copy)
@@ -1153,7 +1153,7 @@
# ifdef STACK_GROWS_DOWN
return stack_addr + stack_size;
# else
- return stack_addr - stack_size;
+ return stack_addr;
# endif
# else