From e209cfd18124d3900db610392b85497351793511 Mon Sep 17 00:00:00 2001 From: hboehm Date: Sun, 26 Oct 2008 05:22:45 +0000 Subject: [PATCH] 2008-10-25 Hans Boehm (Really Ivan Maidansky) * mark_rts.c (GC_approx_sp): Use volatile to avoid common warning. --- ChangeLog | 4 ++++ mark_rts.c | 16 +++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1257f168..2bcf2ee3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-10-25 Hans Boehm (Really Ivan Maidansky) + * mark_rts.c (GC_approx_sp): Use volatile to avoid common + warning. + 2008-10-25 Hans Boehm * dyn_load.c (GC_cond_add_roots): Fix GC_get_next_stack argument order. diff --git a/mark_rts.c b/mark_rts.c index 5bb5639e..2b8b7382 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -353,19 +353,13 @@ GC_bool GC_is_tmp_root(ptr_t p) ptr_t GC_approx_sp(void) { - volatile word dummy; - - dummy = 42; /* Force stack to grow if necessary. Otherwise the */ + volatile word sp; + sp = (word)&sp; + /* Also force stack to grow if necessary. Otherwise the */ /* later accesses might cause the kernel to think we're */ /* doing something wrong. */ -# ifdef _MSC_VER -# pragma warning(disable:4172) -# endif - /* Ignore "function returns address of local variable" warning. */ - return((ptr_t)(&dummy)); -# ifdef _MSC_VER -# pragma warning(default:4172) -# endif + + return((ptr_t)sp); } /* -- 2.40.0