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

C23 address spaces handled correctly in canonical types.

C23 canonical type generation now correctly preserves address space qualifiers, fixing disjoint address space errors.

A recent change in GCC’s C type canonicalization logic caused issues with C23’s named address spaces. When a struct member pointed to a type in a specific address space (e.g., __seg_gs), the canonicalization process incorrectly flagged it as an error, claiming disjoint address spaces. This commit corrects the c_type_canonical function to directly copy the qualifiers, including address spaces, from the replaced type instead of using qualify_type, which was merging types inappropriately.

In Details

Following a change for PR125252, c_type_canonical in c-typeck.cc now replaces tagged structures behind pointer members with incomplete types and attempts to copy qualifiers using qualify_type. However, qualify_type incorrectly diagnoses disjoint address spaces when merging a generic type with a type already qualified by a named address space (e.g., __seg_gs). This commit revises c_type_canonical to bypass qualify_type and directly apply the qualifiers of the replaced type to the new incomplete type, resolving the conflict for C23 code using named address spaces.

For Context
C23
The working name for the next revision of the C programming language standard.
canonical type
A unique, normalized representation of a type within the compiler. Used to ensure type identity and consistency.
address space
A mechanism, often architecture-specific, that qualifies memory access. Named address spaces, like __seg_gs on x86, provide finer control over memory locations.
incomplete type
A type for which the compiler knows the name but not the size or layout, such as a forward-declared struct.
Filed Under: cc23address space