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:
Jim Shu 2020-01-21 18:03:33 +08:00 committed by Andrew Boie
commit e1052a0f8d

View file

@ -82,7 +82,7 @@ void alt_thread1(void)
* and xtensa
*/
{
long illegal = 0;
volatile long illegal = 0;
((void(*)(void))&illegal)();
}
#endif