https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84865
--- Comment #9 from Tim Shen <timshen at gcc dot gnu.org> --- I see. Can you show the ulimit *stack* information? I believe it's -s. Also, try -O2 so that the functions are inlined. As for the stack overflow, it's a known issue. To workaround this, please set a bigger stack size.