tests/kernel/fatal: add volatile to prevent compiler optimization
Initialization of local variable 'illegal' can't be optimized, or the program will jump to the memory contains random value which causes the unexpected behavior. Add volatile to local variable 'illegal' to prevent compiler optimization. Signed-off-by: Jim Shu <cwshu@andestech.com>
This commit is contained in:
parent
011da8c1b0
commit
e1052a0f8d
1 changed files with 1 additions and 1 deletions
|
@ -82,7 +82,7 @@ void alt_thread1(void)
|
|||
* and xtensa
|
||||
*/
|
||||
{
|
||||
long illegal = 0;
|
||||
volatile long illegal = 0;
|
||||
((void(*)(void))&illegal)();
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue