summaryrefslogtreecommitdiff
path: root/ptr_chck.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2012-08-01 09:42:36 +0400
committerIvan Maidanski <ivmai@mail.ru>2012-08-01 09:42:36 +0400
commitd6acbda22a4f5bdf4340edacdccf01cc7e38aea8 (patch)
treef2ef982c198353d4d602f3b6ad098f3f6e11e5dd /ptr_chck.c
parent6605aebacb02bcce094db7a0ce07d8731b907955 (diff)
downloadbdwgc-d6acbda22a4f5bdf4340edacdccf01cc7e38aea8.tar.gz
Fix all address-of-dummy operations by adding volatile
* alloc.c (min_bytes_allocd, GC_stopped_mark): Use volatile for 'dummy' local variable (used to get 'sp' value) to prevent any harmful optimizations (e.g., some Mac OS X clang releases might turn a conditional expression that uses 'dummy' address into a constant). * dyn_load.c (GC_cond_add_roots): Likewise. * mach_dep.c (GC_with_callee_saves_pushed): Likewise. * misc.c (GC_clear_stack_inner, GC_init, GC_call_with_stack_base): Likewise. * os_dep.c (GC_get_stack_base, GC_get_main_stack_base, async_set_pht_entry_from_index): Likewise. * pthread_stop_world.c (nacl_pre_syscall_hook, __nacl_suspend_thread_if_needed): Likewise. * pthread_support.c (GC_thr_init): Likewise. * ptr_chck.c (GC_on_stack): Likewise. * tools/setjmp_t.c (main): Likewise. * win32_threads.c (GC_push_stack_for): Likewise. * dyn_load.c (dummy): Change variable type from char to int. * include/private/gcconfig.h: Update comment about GC_stackbottom initialization. * os_dep.c (GC_get_stack_base): Remove 'sp' local variable. * os_dep.c (GC_get_main_stack_base): Define and use volatile 'dummy' variable (instead of 'result') to get 'sp' value (revert part of commit bddc75f). * os_dep.c (GC_get_stack_base): Add missing cast of 'dummy' address (only if NEED_FIND_LIMIT). * pthread_stop_world.c (GC_suspend_handler_inner): Define and use volatile 'dummy' variable (instead of 'me') to get 'sp' value (revert part of commit 31fc0f6). * pthread_stop_world.c (nacl_pre_syscall_hook, __nacl_suspend_thread_if_needed): Rename 'local_dummy' to 'dummy' local variable.
Diffstat (limited to 'ptr_chck.c')
-rw-r--r--ptr_chck.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ptr_chck.c b/ptr_chck.c
index 068eb189..fd88c162 100644
--- a/ptr_chck.c
+++ b/ptr_chck.c
@@ -163,7 +163,7 @@ void (GC_CALLBACK *GC_is_visible_print_proc)(void * p) =
/* Could p be a stack address? */
STATIC GC_bool GC_on_stack(ptr_t p)
{
- int dummy;
+ volatile int dummy;
# ifdef STACK_GROWS_DOWN
if ((word)p >= (word)(&dummy) && (word)p < (word)GC_stackbottom) {
return(TRUE);