Whether you can or can’t use the function depends on the situation.
The compiler generates code for the following operations in functions to be checked for stack smashing.
- Reserving two consecutive locations immediately before the local variable area of the stack that is related to the function at the entrance to the function then storing the value specified by num in the two bytes at the locations.
- Checking that the value specified by num has not been overwritten on exit from the function.
- Calling the __stack_chk_fail function if it has been overwritten, since this indicates smashing of the stack during execution.
You can use the detection of stack smashing when multi-tasking causes switching to and return from a task, since the situation is the same as that described in 1 and 2.
However, detection cannot be used for an interrupt handler or task of the real-time OS, since stack smashing cannot be detected for a function which is specified with any of the following directives.
#pragma inline， inline keyword，#pragma inline_asm，
#pragma no_stack_protector，#pragma rtos_interrupt，
|CS+ (formerly CubeSuite+)|
|C Compiler Package for RL78 Family|