From: Ivan Maidanski Date: Wed, 7 Sep 2011 14:00:38 +0000 (+0400) Subject: HOTFIX: Always reset fault handler in GC_find_limit_with_bound on exit. X-Git-Tag: gc7_3alpha2~378 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0feaf5b0e429c8062988e0e7c335bf57eb77c6ce;p=gc HOTFIX: Always reset fault handler in GC_find_limit_with_bound on exit. * 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). --- diff --git a/os_dep.c b/os_dep.c index 82223e9e..0290e2e0 100644 --- 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 */