]> granicus.if.org Git - gc/commitdiff
Fix GC_clear_stack_inner by using GC_approx_sp
authorIvan Maidanski <ivmai@mail.ru>
Wed, 1 Aug 2012 22:02:08 +0000 (02:02 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 1 Aug 2012 22:02:08 +0000 (02:02 +0400)
* misc.c (GC_clear_stack_inner): Use GC_approx_sp() instead of
"dummy[0]" set to "&dummy" value (that worked as expected only for
STACK_GROWS_DOWN case).

misc.c

diff --git a/misc.c b/misc.c
index 3370357d5dfe0728961ff50ff49c2b7e443489a1..6180b19db7197b70dd0db4e2c4f395ee4ded02d6 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -303,11 +303,8 @@ GC_INNER void GC_extend_size_map(size_t i)
   {
     volatile word dummy[CLEAR_SIZE];
 
-    dummy[0] = (word)(&dummy);
-                /* Store to a volatile variable prevents the following  */
-                /* condition to be 'optimized' to TRUE constant.        */
-    BZERO((/* no volatile */ void *)&dummy[1], (CLEAR_SIZE-1) * sizeof(word));
-    if (dummy[0] COOLER_THAN (word)limit) {
+    BZERO((/* no volatile */ void *)dummy, sizeof(dummy));
+    if ((word)GC_approx_sp() COOLER_THAN (word)limit) {
         (void) GC_clear_stack_inner(arg, limit);
     }
     /* Make sure the recursive call is not a tail call, and the bzero   */