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

Fix ICE on out of bounds vector element access.

Corrects a bug in vector element access handling that could lead to compiler internal errors.

The instruction selector (isel) pass in GCC could encounter an internal compiler error (ICE) when processing out-of-bounds vector element accesses. This was due to incorrect bounds checking logic that mishandled constant indices, particularly negative ones. The fix ensures correct handling of these cases by punting when indices don’t fit expected types and by using a more accurate comparison for bounds checks, preventing ICEs and ensuring correct code generation.

In Details

The gimple_expand_vec_set_extract_expr in gimple-isel.cc previously mishandled out-of-bounds vector element access checks. Constant indices that wouldn't fit into poly_uint64 (potentially negative values) bypassed a preliminary check due to incorrect type conversion. Additionally, the known_gt check was imprecise, allowing indices equal to the number of elements (which is out of bounds for .VEC_SET). This commit corrects this by punting for poly_int_tree_p indices that don't fit poly_uint64 and uses known_ge for a precise bounds check, resolving PR126446.

For Context
isel
The instruction selector pass in GCC, responsible for translating GIMPLE intermediate representation into RTL (Register Transfer Language) instructions specific to the target architecture.
ICE
Internal Compiler Error. A serious error occurs within the compiler itself, preventing it from completing the compilation process. These typically indicate bugs in the compiler.
GIMPLE
GNU Intermediate Language. A three-address code (3AC) representation used by GCC after parsing and before optimization passes that operate on RTL.
RTL
Register Transfer Language. An intermediate representation used by GCC that more closely resembles machine instructions than GIMPLE, used for instruction selection, scheduling, and target-specific optimizations.
poly_uint64
A type used in GCC for representing unsigned integer values, often in the context of symbolic or range analysis, which can handle wider ranges or expressions than standard integer types.
Filed Under: optimizationvectorizationbugfix