diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-15 18:56:48 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-05-15 18:56:48 +0000 |
commit | fe725c000bde67b9f30531e0b6beb0201c88a747 (patch) | |
tree | 13237911691923e59273af3da119f118ad1f4fc3 /libgo | |
parent | eb606595780c992930863e8f2db1f31b53bed7ba (diff) | |
download | gcc-fe725c000bde67b9f30531e0b6beb0201c88a747.zip gcc-fe725c000bde67b9f30531e0b6beb0201c88a747.tar.gz gcc-fe725c000bde67b9f30531e0b6beb0201c88a747.tar.bz2 |
runtime: Make all variables used across getcontext volatile.
From-SVN: r187549
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/proc.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c index eabd5e8..0862c60 100644 --- a/libgo/runtime/proc.c +++ b/libgo/runtime/proc.c @@ -1322,7 +1322,7 @@ __go_go(void (*fn)(void*), void* arg) { byte *sp; size_t spsize; - G * volatile newg; // volatile to avoid longjmp warning + G *newg; schedlock(); @@ -1363,19 +1363,26 @@ __go_go(void (*fn)(void*), void* arg) if(sp == nil) runtime_throw("nil g->stack0"); - getcontext(&newg->context); - newg->context.uc_stack.ss_sp = sp; + { + // Avoid warnings about variables clobbered by + // longjmp. + byte * volatile vsp = sp; + size_t volatile vspsize = spsize; + G * volatile vnewg = newg; + + getcontext(&vnewg->context); + vnewg->context.uc_stack.ss_sp = vsp; #ifdef MAKECONTEXT_STACK_TOP - newg->context.uc_stack.ss_sp += spsize; + vnewg->context.uc_stack.ss_sp += vspsize; #endif - newg->context.uc_stack.ss_size = spsize; - makecontext(&newg->context, kickoff, 0); + vnewg->context.uc_stack.ss_size = vspsize; + makecontext(&vnewg->context, kickoff, 0); - newprocreadylocked(newg); - schedunlock(); + newprocreadylocked(vnewg); + schedunlock(); - return newg; -//printf(" goid=%d\n", newg->goid); + return vnewg; + } } // Put on gfree list. Sched must be locked. |