Static Stack Usage Analysis (GNAT User’s Guide for Native Platforms)

#### 6.6.2 Static Stack Usage Analysis ¶

A unit compiled with the `-fstack-usage` switch generate an extra file that specifies the maximum amount of stack used on a per-function basis. The file has the same basename as the target object file with a `.su` extension. Each line of this file is made up of three fields:

- The name of the function.
- A number of bytes.
- One or more qualifiers: `static`, `dynamic`, `bounded`.

The second field corresponds to the size of the known part of the function frame.

The qualifier `static` means that the function frame size is purely static. It usually means that all local variables have a static size. In this case, the second field is a reliable measure of the function stack utilization.

The qualifier `dynamic` means that the function frame size is not static. It happens mainly when some local variables have a dynamic size. When this qualifier appears alone, the second field is not a reliable measure of the function stack analysis. When it is qualified with `bounded`, it means that the second field is a reliable maximum of the function stack utilization.

Compilation of a unit with the `-Wstack-usage` switch will issue a warning for each subprogram whose stack usage might be larger than the specified amount of bytes. The wording of that warning is consistent with that in the file documented above.

This is not supported by the LLVM back end.