]> granicus.if.org Git - gc/commitdiff
HOTFIX: Always reset fault handler in GC_find_limit_with_bound on exit.
authorIvan Maidanski <ivmai@mail.ru>
Wed, 7 Sep 2011 14:00:38 +0000 (18:00 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 7 Sep 2011 14:00:38 +0000 (18:00 +0400)
* os_dep.c (GC_find_limit_with_bound): Inside loop, set result local
volatile variable and do break instead of return (this also suppresses
compiler warning about the potential clobbering of "bound" variable
by setjmp).

os_dep.c

index 82223e9e17e2f191653c0ded0b105dab8f39ba69..0290e2e0420cdae1f403c59449827a94c22190d7 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -939,10 +939,21 @@ GC_INNER word GC_page_size = 0;
             for (;;) {
                 if (up) {
                     result += MIN_PAGE_SIZE;
-                    if (result >= bound) return bound;
+                    if (result >= bound) {
+                      result = bound;
+                      break;
+                    }
                 } else {
                     result -= MIN_PAGE_SIZE;
-                    if (result <= bound) return bound;
+                    if (result <= bound) {
+                      result = bound - MIN_PAGE_SIZE;
+                                        /* This is to compensate        */
+                                        /* further result increment (we */
+                                        /* do not modify "up" variable  */
+                                        /* since it might be clobbered  */
+                                        /* by setjmp otherwise).        */
+                      break;
+                    }
                 }
                 GC_noop1((word)(*result));
             }
@@ -1356,7 +1367,7 @@ GC_INNER word GC_page_size = 0;
   {
     sb->mem_base = rtems_get_stack_bottom();
     return GC_SUCCESS;
-  } 
+  }
 # define HAVE_GET_STACK_BASE
 #endif /* GC_RTEMS_PTHREADS */