Skip to content

Enhancement: Add support for 'alloca'-based stack allocations in static analysis #8

@SizzleUnrlsd

Description

@SizzleUnrlsd

Summary
Support for functions using alloca has been added to the static analyzer so that dynamic stack allocations are now taken into account during stack usage analysis.

Details
Previously, the analyzer only handled fixed-size stack allocations. Functions relying on alloca (or equivalent IR instructions) were either ignored or underestimated in terms of stack usage.
With this change, alloca-based allocations are now detected and integrated into the stack usage computation, improving the accuracy of the analysis for functions that perform dynamic stack allocations.

Scope / Behavior
• Detect alloca instructions during analysis.
• Incorporate dynamically allocated stack size into the per-function stack usage calculation.
• Ensure functions using alloca are flagged/marked appropriately in the analysis output (if applicable).

Tasks
• Implement alloca handling in the static analysis core.
• Integrate alloca allocations into stack usage computation.
• Add or extend test cases covering functions that use alloca.
• Update documentation to mention alloca support and any limitations.
• Add a regression test to prevent future regressions on alloca handling.

Notes
If any edge cases appear (nested alloca, large dynamic allocations, interaction with recursion, etc.), they can be tracked in follow-up issues.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions