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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
might be nice to have a way to declare a variable at a fixed address so the
code can become

extern hab_rvt_entry_p **entryptr __attribute__((at(0x908)));

int main() {
        hab_rvt_entry_t *a = *entryptr;
        a();
        return 0;
}

(I googled that some embedded compiler suppports 'at')

Note if you have a definition there's a workaround to declare the
variable in a custom section and use a linker script to place that
at a fixed address.  Still that doesn't allow the compiler to
optimize the access instructions.

We could honor the 'at' attribute when expanding the variable to RTL.

Such variables are going to be interesting for alias analysis btw,
so we should document it being undefined when a variables declared
with 'at' overlaps with another variable (or allocated object).
  • [Bug c/106920] N... npfhrotynz-ptnqh.myvf at noclue dot notk.org via Gcc-bugs
    • [Bug c/1069... rguenth at gcc dot gnu.org via Gcc-bugs
    • [Bug c/1069... npfhrotynz-ptnqh.myvf at noclue dot notk.org via Gcc-bugs
    • [Bug c/1069... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug c/1069... rguenth at gcc dot gnu.org via Gcc-bugs
    • [Bug c/1069... npfhrotynz-ptnqh.myvf at noclue dot notk.org via Gcc-bugs

Reply via email to