binutils Newspaper
NOVEMBER 30, 2026
binutils — Proposed

Fix undefined shift in tilepro/tilegx disassemblers

Changes integer operand values to unsigned to prevent undefined shift behavior.

This patch prevents undefined shift behavior in the tilepro and tilegx disassemblers by changing the type of operand_values from int to unsigned int. This addresses a potential UBSan error when the top bit of a signed integer operand is set, which would lead to an undefined left shift. The change aligns the types with how values are stored and makes the code safer.

In Details

The print_insn_tilepro and print_insn_tilegx functions, part of the opcodes library, disassemble instructions for the TilePro and TileGX processors. The tilepro_decoded_instruction and tilegx_decoded_instruction structures store operand values in operand_values fields. If these fields were signed integers (int or long long), and the most significant bit was set, a left shift operation on such a value is undefined behavior in C. This can lead to compiler warnings (like UBSan's signed integer overflow) or unexpected runtime behavior. By changing operand_values to unsigned int,…

For Context
undefined behavior
Behavior that results from an implementation of a C/C++ program that depends on the platform, compiler, or other factors, and is not specified by the C/C++ language standards. It can lead to crashes, incorrect results, or security vulnerabilities.
UBSan
Undefined Behavior Sanitizer. A runtime checker that detects various kinds of undefined behavior in C/C++ code.
disassembler
A program that translates machine code (binary instructions) back into a human-readable assembly language format.
operand
A value or variable on which an instruction operates.
tilepro
A family of DSP processors from Tilera Corporation.
tilegx
A family of multi-core processors from Tilera Corporation, successors to TilePro.
signed integer
An integer data type that can represent positive and negative values, as well as zero. The most significant bit is typically used to indicate the sign.
unsigned integer
An integer data type that can represent only non-negative values. All bits are used to represent the magnitude of the number.
Filed Under: compilerubsandisassemblertileprotilegx