To detect stack overflow, compile your C, C++, or Fortran program with the -xcheck=stkovf compiler option. The syntax is as follows:
-xcheck=stkovf[:detect | :diagnose]
If -xheck=stkovf:detect is specified, a detected stack overflow error is handled by executing the signal handler normally associated with the error.
If -xcheck=stkovf:diagnose is specified, a detected stack overflow error is handled by catching the associated signal and calling stack_violation(3C) to diagnose the error. If a stack overflow error is diagnosed, an error message is printed to stderr. This is the default behavior if only -xcheck=stkovf is specified.
See the cc(1), CC(1), or f95(1) man pages for more information about the -xcheck=stkovf compiler option.