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

GCC: Stop using 'int' for qualifier sets

GCC's type qualifier representation updated to handle address spaces correctly.

GCC is changing how it represents type qualifiers. Previously, int was used as a bitmask for qualifiers like const and volatile. However, with the introduction of address space qualifiers, this approach leads to incorrect bitwise operations when merging qualifier sets. This commit modifies the internal representation to correctly handle the combination of standard qualifiers and address spaces, preventing subtle bugs, particularly in C++ named address space support.

In Details

The GCC frontend's internal representation of TYPE_QUALS is being updated. Previously, int was used as a bitset to store const, volatile, restrict, and atomic qualifiers, alongside address space information. This commit rectifies issues where bitwise ORing these int values led to incorrect semantics when address spaces were involved, as seen in C++ named address space support (e.g., GCN target). The change ensures that qualifier merging logic correctly distinguishes and combines standard qualifiers and address spaces, avoiding erroneous diagnostics.

For Context
TYPE_QUALS
An internal GCC data structure that stores qualification information for a given type. This includes attributes like const, volatile, restrict, and address spaces.
qualifier
Keywords in C/C++ that modify the behavior or meaning of a type, such as const (read-only), volatile (unpredictable changes), restrict (no aliasing), and address space qualifiers.
address space qualifier
A qualifier that specifies where a variable or data resides in memory, such as __generic, __flat, __lds, or __gds in specific target architectures. GCC's support for these has grown, necessitating a more robust representation than simple bitmasks.
bitmask
A sequence of bits used to manipulate or test individual bits within a larger integer value. In GCC, integers have been used as bitmasks to represent sets of flags or qualifiers.
C++ Named Address Spaces
A C++ language feature that allows developers to specify custom memory regions or address spaces for variables, enabling more fine-grained control over memory access, especially on hardware with diverse memory architectures.
GCN target
Graphics Core Next, an architecture developed by AMD for its GPUs. GCC's support for GCN involves specific optimizations and handling of its unique memory model, including custom address spaces.
Filed Under: gcctype systemcorrectnessc++