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

bitintlower: Fix miscompilation with unsigned add/subtract operations

Fixes incorrect handling of unsigned add/subtract operations for bit-integers, resolving miscompilations on certain architectures.

This commit addresses a miscompilation issue on aarch64 related to unsigned add/subtract operations on bit-integers. The problem arose when specific target architectures used different instruction sets for these operations, leading to incorrect results. The fix ensures correct handling by properly utilizing the appropriate instructions or fallbacks, thus resolving the miscompilation.

In Details

The bitintlower pass optimizes bit-integer operations. This change corrects the use of IFN_UADDC/IFN_USUBC vs. .SUB_OVERFLOW based on target optabs. Targets without specific optabs incorrectly used general .SUB_OVERFLOW for bit-integer arithmetic, leading to incorrect results when overflow/underflow semantics differ from standard integer types.

For Context
bitintlower
A GCC compiler pass that lowers operations on variable-width integers (bit-integers) into more primitive operations understandable by the target architecture.
optabs
Optimization tables in GCC that define machine-specific operations, allowing the compiler to select the most efficient instructions for a given target.
IFN_UADDC/IFN_USUBC
Specific instructions or patterns used for unsigned addition with carry and unsigned subtraction with borrow, often optimized for bit-integer operations.
aarch64
The 64-bit ARM architecture, commonly used in mobile devices and servers, with its own set of instructions and calling conventions.
Filed Under: compileroptimizationbit-intaarch64