4.2.9.1 Stack Guidance Information

The stack guidance features estimates the stack usage of the data stack used by programs compiled with the MPLAB XC8 C Compiler.

The following example shows a stack usage information summary that might be displayed after a successful build.
======================== STACK USAGE GUIDANCE ========================
In the call graph beginning at 'main',
   52 bytes of stack are required.

However, the following cautions exist:

1. Recursion has been detected:
   __fp_splitA
No stack usage predictions can be made.

2. The following labels are interrupt functions:
   __vector_18 uses 15 bytes
You must add stack allowances for those functions.

3. The following labels cannot be connected to the main call graph.
This is usually caused by some indirection:
   func1 uses 2 bytes
   func2 uses 0 bytes
   __fp_zero uses 0 bytes
You must add stack allowances for those functions.
======================================================================

The information will show the total estimated program stack usage.

In addition, a number of cautionary messages might be displayed. These clarify potential stack overflows reported by the above estimate and indicate additional stack usage that must be considered to determine a more accurate program stack usage. Due to factors that make it impossible to know when this additional memory might be used, these are not incorporated into the earlier summary.

The following cautions might be displayed in the described circumstances.
Recursive functions
Recursive function calls were detected in the main call graph. As the number of iterations of a recursive call cannot be predicted, the total software stack size cannot be determined, so no stack guidance is possible. The names of recursive functions detected are listed in this caution.
Disconnected functions
Functions that have not been directly called have been detected. Such functions might have been called, either indirectly in C code or by some other means, of they may not have been called at all. The stack usage of each function is indicated in this caution and need to be taken into account when considering the total software stack usage of your program.
Indeterminate calls
Indeterminate calls have been detected in the main call graph. These might be for example indirect calls or calls to a label. The number of bytes used by the calls is indicated in this caution and need to be taken into account when considering the total software stack usage of your program.
Indeterminate stack adjustments
Indeterminate stack adjustments have been detected in the main call graph. This might be the result of the use of variable-length arrays, the use of memory-allocation functions like alloca (which allocate memory on the stack rather than functions like malloc, which allocate on the heap), or the presence of functions without stack information available. No memory usage information regarding these situations can be reported. A static calculation of the additional bytes that are known to be used is indicated in this caution. These represent the minimum number of additional bytes used by your program.
Interrupt functions
Even though the size of the stack used by main-line and interrupt call graphs might be accurately known, interrupts can trigger at any time, and given this is the case, the compiler cannot reliably determine the program's total stack usage. This caution alerts you to the existence of interrupt functions and that the stack usage of these will need to be taken into account when considering the total software stack usage of your program.