GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gcc

Improve variadic function call handling in PTA

Pointed-to-analysis (PTA) now better handles variadic functions, improving precision for calls involving `__builtin_va_start` and `.VA_ARG`.

This commit enhances the precision of Pointer Analysis (PTA) for variadic function calls. It correctly handles __builtin_va_start and .VA_ARG during constraint generation, reducing unnecessary conservative assumptions. This change resolves an issue that caused an expected error in a test case involving indirect variadic calls, leading to more accurate analysis.

In Details

The Pointed-to Analysis (PTA) constraint generation in gimple-ssa-pta-constraints.cc is improved. Specifically, find_func_aliases_for_builtin_call now uses SCALAR RHS for variadic argument parts or NONLOCAL for intra-PTA contexts. The find_func_aliases_for_call function now handles .VA_ARG. This resolves PR99679 by not calling aggregate_value_p on .VA_ARG calls, and a new test case validates precision for indirect variadic calls.

For Context
PTA
Pointer Analysis. A technique used by compilers to determine the set of memory locations a pointer might refer to, crucial for many optimizations.
Variadic Function
A function that can accept an arbitrary number of arguments, indicated by an ellipsis (...) in its definition. Examples include printf and scanf.
VA_ARG
A macro used to access arguments passed to a variadic function. It requires a va_list and the type of the argument to retrieve.
Filed Under: ptaoptimizationvariadic