mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 14:18:20 +00:00
testsuites/validation/tc-task-restart.c: Address -Wclobbered warning
Code should not rely on the contents of local variables set before setjmp() after the longjmp() returns. In this case, it was possible to set cpu_self after the return from setjmp(). This case was not addressed by adding the "returns_twice" attribute to setjmp() in setjmp.h. Updates #5364.
This commit is contained in:
@@ -779,7 +779,12 @@ static void Signal( rtems_signal_set signals )
|
||||
SetFatalHandler( ResumeThreadDispatch, ctx );
|
||||
cpu_self = _Thread_Dispatch_disable();
|
||||
|
||||
if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
|
||||
int jumped = setjmp( ctx->thread_dispatch_context );
|
||||
|
||||
/* cpu_self can be clobbered by setjmp/longjmp, so reload it */
|
||||
cpu_self = _Per_CPU_Get();
|
||||
|
||||
if ( jumped == 0 ) {
|
||||
Block( ctx );
|
||||
} else {
|
||||
_Thread_Dispatch_unnest( cpu_self );
|
||||
|
||||
Reference in New Issue
Block a user