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

            Bug ID: 123583
           Summary: Named address space qualifier causes undeclared
                    identifier error
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: saaadhu at gcc dot gnu.org
  Target Milestone: ---

The below code triggers a compilation error, even though __memx is a valid
address space qualifier.

$ cat test.c
void h() {
    if(1)
      ;
  __memx const int *x = 0;
}

$ ~/install/bin/avr-gcc test.c
test.c: In function:
test.c:6:3: error:__mem undeclared (first use in this function)
    6 |   __memx const int *x = 0;
      |   ^~~~~~
test.c:6:3: note: each undeclared identifier is reported only once for each
function it appears in
test.c:6:9: error: expected beforeconst
    6 |   __memx const int *x = 0;
      |         ^~~~~~
      |         ;

$ avr-gcc --version
avr-gcc (GCC) 16.0.1 20260114 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Swapping the order of the qualifiers (i.e. const __memx) makes the error go
away, and so does adding an extra token (say ;) after the between the ; and
__memx.

Reply via email to