GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
genmodes

Define MODE_UNIT_SIZE_TYPE for all host compilers in genmodes.

Ensures MODE_UNIT_SIZE_TYPE is defined for non-GCC host compilers to prevent build errors.

A recent change in GCC’s genmodes intended to use wider types for mode_unit_size arrays. However, the definition of MODE_UNIT_SIZE_TYPE was emitted only when the host compiler was GCC, causing issues for other host compilers. This commit moves the definition to insn-modes.h, making it consistently available and resolving build failures on non-GCC hosts.

In Details

Commit 05601826737 introduced MODE_UNIT_SIZE_TYPE to accommodate wider mode_unit_size arrays, emitting it from emit_mode_unit_size_inline within insn-modes-inline.h. This emission was guarded by !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001. Consequently, if the host compiler is not GCC (or an older GCC version), MODE_UNIT_SIZE_TYPE remains undefined, but machmode.h still references it. This patch relocates the definition to insn-modes.h alongside CONST_MODE_UNIT_SIZE, ensuring it's always defined regardless of the host compiler.

For Context
genmodes
A GCC tool responsible for generating machine mode definitions based on descriptions in machine description files.
MODE_UNIT_SIZE_TYPE
A C++ type definition used internally by GCC to specify the size of elements in mode-related arrays, particularly for machine modes.
host compiler
The compiler used to build GCC itself. This is distinct from the target compiler, which GCC is configured to generate code for.
insn-modes.h
A GCC header file containing definitions related to machine modes, which represent data types and sizes for a target architecture.
Filed Under: buildgenmodescompiler