GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
testsuite

Add test case for path solver positional invariant

New test case reproduces a crash in the thread pass caused by incorrect path solver context.

This commit adds a new test case to reproduce a crash that occurred in the thread pass at optimization level -O2, stemming from an incorrect positional context used by the path solver. The issue arose when match.pd queried the solver with a statement from an arbitrary block, leading to segfaults due to incorrect edge lookups when handling PHI nodes out of their expected block context.

In Details

The gcc.dg/tree-ssa/pr126876.c test case targets a regression in the thread pass following r17-3298. It specifically triggers a scenario where match.pd's gimple_match_range_of_expr queries internal_range_of_expr with a context statement from a different block. This causes range_defined_in_block to receive a PHI node from an 'out of position' block, leading to null pointer dereferences in find_edge or PHI_ARG_DEF_FROM_EDGE when validating abnormal edges.

For Context
Thread Pass
A compiler optimization pass that analyzes and potentially modifies code related to threading or concurrency, possibly for performance or correctness.
Path Solver
A component within the compiler's optimization passes that analyzes different execution paths (control flow) through a program to determine properties of variables or expressions along those paths.
PHI node
In SSA form, a special instruction used at the join of two or more control flow paths to merge values from different predecessors. It represents a choice of values based on which path was taken.
SSA
Static Single Assignment. An intermediate representation property where every variable is assigned a value exactly once. This simplifies many compiler optimizations.
GIMPLE
GCC's internal representation (IR) used for optimization after the initial parsing and before the final machine code generation. It's a three-address code form.
Filed Under: testsuiteoptimizationcrashfixregression