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

--- Comment #18 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a x86_64 testcase:
```
typedef __UINT16_TYPE__ T;

#define NI __attribute__((noinline,noclone,no_icf))

static const __seg_fs T xyz_prog[] = { 123, 123, 123 };
static __seg_gs T xyz[] = { 123, 123, 123 };
volatile int x = 0;

NI void prf (T f)
{
    if (f != 123)
        __builtin_abort();
}

NI void func_progmem()
{
    prf(xyz_prog[x]);
}

NI void func_ram()
{
    prf(xyz[x]);
}

int main()
{
    func_progmem();
    func_ram();
}
```

We get:
        movzwl  %fs:xyz_prog(%rax,%rax), %edi
...
        movzwl  %gs:xyz(%rax,%rax), %edi
...
        .section        .rodata
        .align 2
        .type   xyz_prog, @object
        .size   xyz_prog, 6
xyz_prog:
        .value  123
        .value  123
        .value  123
        .set    xyz,xyz_prog

Maybe for x86_64, it is less of an issue because the fs/gs address space
overlap with the main address space.

Reply via email to