Fix segmentation fault in avmshell -Dselftest

GCC optimizations seems breaking the codes