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

Allow UBSan to instrument signed integral vector types.

Enables UBSan to detect signed integer overflows in vector types, improving sanitization coverage.

This commit modifies the TYPE_OVERFLOW_SANITIZED predicate to accept integral vector types, allowing Undefined Behavior Sanitizer (UBSan) to instrument signed integral vector arithmetic. Previously, TYPE_OVERFLOW_SANITIZED only accepted scalar types, preventing UBSan from detecting overflows in vector operations. This change ensures that diagnostics are generated for vector operations that can overflow, as demonstrated in a test case involving vector negation.

In Details

The tree representation in GCC uses TYPE_OVERFLOW_SANITIZED to mark types for which overflow checks should be performed. Previously, this flag was restricted to scalar integral types. This change expands the check using ANY_INTEGRAL_TYPE_P to include vector types. This is important for Signed Integer Overflow UBSan, as it can now detect overflows in operations like v4si negation, preventing optimization passes from incorrectly removing diagnostics by folding potentially overflowing operations.

For Context
UBSan
Undefined Behavior Sanitizer, a runtime instrumentation tool to detect various kinds of undefined behavior in C/C++ programs.
signed integral vector types
Data types that hold multiple signed integer values, often used for SIMD (Single Instruction, Multiple Data) operations.
tree representation
An intermediate representation used by GCC after initial parsing and before code generation, representing the program's structure and data flow.
TYPE_OVERFLOW_SANITIZED
A flag associated with a GCC type indicating that signed integer overflow checks should be performed.
vector types
Data types that represent arrays of elements, often processed in parallel by specialized hardware instructions (SIMD).
Filed Under: sanitizervectorization UBSan