From 750f5313f7d9eabd2c0bb07718f23257ff43aa64 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 5 Dec 2013 11:19:00 +0100 Subject: [PATCH] base: avoid compiler warning in Thread::stack_top The statement _context->stack[-1] triggered the compiler warning 'array subscript is below array bounds'. ref #989 --- base/include/base/thread.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/base/include/base/thread.h b/base/include/base/thread.h index 833c8d606..caa93ca99 100644 --- a/base/include/base/thread.h +++ b/base/include/base/thread.h @@ -335,7 +335,11 @@ namespace Genode { * * \return pointer to first stack element */ - void *stack_top() { return &_context->stack[-1]; } + void *stack_top() + { + return (void *)((addr_t)_context->stack - + sizeof(_context->stack[0])); + } /** * Return base of stack