GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-optimization

Add PTA constraints for restrict-qualified parameter fields

Fixes Points-To Analysis (PTA) for restrict-qualified parameters with fields to avoid empty points-to sets.

This change addresses an issue in Points-To Analysis (PTA) concerning restrict-qualified parameters that have fields. When a fake pointed-to variable is not generated for such parameters, a constraint from NONLOCAL is now added. This ensures that the points-to set for these restrict-qualified variables or fields is not empty, which was a latent issue. It also fixes a related problem where pointed-to types with placeholders never received any constraints, improving the accuracy and robustness of PTA.

In Details

This commit enhances create_variable_info_for_1 in gimple-ssa-pta-constraints.cc to correctly handle restrict-qualified parameters with fields. When recursion is detected for the same structure type and a fake pointed-to variable is not created, a NONLOCAL constraint is now added. This prevents the points-to set of the restrict-qualified variable/field from being empty. Additionally, it rectifies a latent issue where pointed-to types containing placeholders would never acquire constraints. This is crucial for PTA accuracy, especially in complex C++ code with restrict qualifiers and ne…

For Context
Points-To Analysis (PTA)
A static analysis technique used by compilers to determine, for each pointer in a program, the set of memory locations that the pointer might possibly refer to.
SSA
Static Single Assignment. An intermediate representation where every variable is assigned exactly once, simplifying many dataflow analyses and optimizations.
restrict
A C99 keyword that provides a promise to the compiler that a pointer is the sole initial means of accessing a particular object. This can enable more aggressive optimizations.
NONLOCAL
A concept in Points-To Analysis representing memory locations that are not necessarily constrained within the current scope, often associated with global or external variables.
Filed Under: points-to analysisoptimizationrestrictC++