#1666 closed defect (fixed)

libmisc/stackchk/check.c: unclean code

Reported by: Ralf Corsepius Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.10
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Another serious warning GCC emits:

../../../../../../c/src/../../cpukit/libmisc/stackchk/check.c:413: warning: 'stack' may be used uninitialized in this function
../../../../../../c/src/../../cpukit/libmisc/stackchk/check.c:384: warning: 'low' may be used uninitialized in this function

The code in question reads:

void *low;

..

Stack_Control *stack;

..

#if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)

if (the_thread == (Thread_Control *) -1) {

if (!Stack_check_Interrupt_stack.area)

return;

stack = &Stack_check_Interrupt_stack;
the_thread = 0;
current = 0;

} else

#else

{

stack = &the_thread->Start.Initial_stack;
current = (void *)_CPU_Context_Get_SP( &the_thread->Registers );

}

#endif
low = Stack_check_usable_stack_start(stack);
size = Stack_check_usable_stack_size(stack);

...

I.e. stack will be uninitialized in case
CPU_ALLOCATE_INTERRUPT_STACK == TRUE
and if the_thread != -1

No idea how to fix this.

Change History (1)

comment:1 Changed on Nov 8, 2010 at 10:20:58 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

No comments. Assuming this is fixed now.

Note: See TracTickets for help on using tickets.