https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128789
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Vineet Gupta <[email protected]>: https://gcc.gnu.org/g:b1ab6f77ae53b37eaf9db6e0defae67f3df0b246 commit r17-6368-gb1ab6f77ae53b37eaf9db6e0defae67f3df0b246 Author: Vineet Gupta <[email protected]> Date: Tue Nov 17 15:36:19 2026 -0800 c: keep the address space in a C23 canonical type quietly [PR128789] Since r17-1272 (PR125252), c_type_canonical replaces a tagged structure nested behind a pointer member with an incomplete type, and copies its qualifiers with qualify_type. qualify_type merges two types and diagnoses disjoint address spaces. The new type is generic, so on x86 a member such as struct S { int x; }; struct C { struct S __seg_gs *p; }; is rejected in C23 mode with "'struct S' and '__seg_gs struct S' are in disjoint named address spaces". GCC 16.1 accepts it. Nothing is being merged here: the incomplete type should just take the qualifiers of the type it replaces. Build it with those directly. PR c/128789 gcc/c/ChangeLog: * c-typeck.cc (c_type_canonical): Copy the qualifiers of the replaced type directly instead of using qualify_type. gcc/testsuite/ChangeLog: * gcc.target/i386/addr-space-7.c: New test.
