GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gcc/tree-optimization

Fix potential overlap in bitint multiplication overflow checks

Ensures safe handling of bit-integer multiplication overflow by preventing overlap between destination and source operands.

This commit addresses a potential issue in the bitintlower pass where the destination and source operands for multiplication overflow checks could overlap. It modifies build_bitint_stmt_ssa_conflicts to treat IFN_MUL_OVERFLOW and IFN_UBSAN_CHECK_MUL operations as multiplication/division types, preventing data corruption in libgcc’s __mulbitint3 calls.

In Details

The bitintlower pass previously had a bug in build_bitint_stmt_ssa_conflicts where it did not correctly handle potential overlaps between the LHS (destination) and input operands for __mulbitint3 and __divmodbitint4 when muldiv_p was false. This commit ensures IFN_MUL_OVERFLOW and IFN_UBSAN_CHECK_MUL are always treated as muldiv_p = true, thereby guaranteeing that use operations on SSA operands are performed before the def on the LHS, preventing memory corruption in the libgcc functions.

For Context
bitintlower
A GCC compiler pass responsible for lowering user-defined bit-integer types into machine-independent intermediate representations.
SSA
Static Single Assignment form, an intermediate representation in compilers where every variable is assigned a value exactly once.
LHS
Left-Hand Side, typically referring to the destination or the left operand in an assignment or expression.
libgcc
The GCC runtime library that provides support for built-in functions and operations not directly supported by the target hardware.
muldiv_p
A flag indicating whether an operation is a multiplication or division, which affects how operand overlaps are handled in the bitint lowering pass.
Filed Under: optimizationbitintcompiler-pass