https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87626

            Bug ID: 87626
           Summary: Named address spaces don't work in standard-conforming
                    mode, but macros for them are defined
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bugdal at aerifal dot cx
  Target Milestone: ---

When invoked in standards conforming mode, e.g. -std=c99, gcc on x86 defined
__SEG_FS and __SEG_GS but they __seg_fs and __seg_gs keywords do not work and
produce errors.

This is because c/c-decl.c: c_register_addr_space explicitly refuses to
register the keyword if flag_no_asm is set, presumably because some targets
define address space names that are not in the reserved namespace.

Either the macros __SEG_* should be suppressed when the functionality they
represent is not available, or it should be fixed to work in all cases. I would
highly prefer the latter. A simple fix would be only returning without doing
anything if word[0]!='_'||word[1]!='_'. A better fix might be automatically
registering the __-prefixed version if word itself is not __-prefixed, and
registering both when flag_no_asm is not set.

Reply via email to