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

Fix ICE with empty reduction in vectorization analysis

Corrects a bug in vectorization analysis that caused an ICE when encountering empty reduction chains.

This commit resolves an internal compiler error (ICE) in the vectorization analysis pass (vect_analyze_slp_reduc_chain). The bug occurred when the analysis attempted to access a non-existent statement after verifying its existence. The fix ensures that the statement is accessed only after its presence is confirmed, preventing the ICE and adding a new test case for this scenario.

In Details

Fixes an ICE in vect_analyze_slp_reduc_chain within tree-vect-slp.cc where scalar_stmts[0] was accessed before verifying its existence. This corrects the analysis logic for reduction chains, preventing crashes when the chain is empty or malformed.

For Context
ICE
Internal Compiler Error, a crash within the compiler itself, usually indicating a bug in the compiler's logic.
vectorization
An optimization process that transforms scalar code into vector code, allowing operations to be performed on multiple data elements simultaneously.
SLP
Sliding Window Pattern, a vectorization technique that finds adjacent identical operations in the code and groups them into a single vector instruction.
reduction chain
A sequence of operations where the result of one operation is used as an input to the next, typically accumulating a value (e.g., sum, product) across a set of data.
Filed Under: optimizationvectorizationcompiler bugpr127105