summaryrefslogtreecommitdiff
path: root/accel-pppd/triton
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2017-12-28 02:27:07 +0500
committerVladislav Grishenko <themiron@mail.ru>2017-12-28 02:27:07 +0500
commit287adbfc205c02eac375f55fb94f13c073faec97 (patch)
treeee7afe2bd94f0266f199c4f140481956c364d7cf /accel-pppd/triton
parentd7c91b0e301375c06feecbb2e714b13860e2c35f (diff)
downloadaccel-ppp-287adbfc205c02eac375f55fb94f13c073faec97.tar.gz
accel-ppp-287adbfc205c02eac375f55fb94f13c073faec97.zip
triton: fix crash due gcc mis-optimization of alloca()
since alloca() result is used indirectly, gcc 4.7.2 thinks the whole call can be dropped on any optimization level.
Diffstat (limited to 'accel-pppd/triton')
-rw-r--r--accel-pppd/triton/triton.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c
index 64ca7b8f..a4567464 100644
--- a/accel-pppd/triton/triton.c
+++ b/accel-pppd/triton/triton.c
@@ -54,6 +54,7 @@ struct triton_context_t default_ctx;
static __thread struct triton_context_t *this_ctx;
static __thread jmp_buf jmp_env;
static __thread void *thread_frame;
+static volatile void *thread_stack;
#define log_debug2(fmt, ...)
@@ -133,7 +134,7 @@ static void* triton_thread(struct _triton_thread_t *thread)
if (this_ctx->before_switch)
this_ctx->before_switch(this_ctx, thread->ctx->bf_arg);
- alloca(thread->ctx->uc->uc_stack.ss_size + 64);
+ thread_stack = alloca(thread->ctx->uc->uc_stack.ss_size + 64);
memcpy(thread_frame - thread->ctx->uc->uc_stack.ss_size, thread->ctx->uc->uc_stack.ss_sp, thread->ctx->uc->uc_stack.ss_size);
setcontext(thread->ctx->uc);
abort();