on linux with -fPIC: static int xs; int printf(char *, ...); int main() { printf("%p\n", &xs); // prints 0x1 int x = xs; // segfaults return 0; } static int xs = 1; seems to be the same as issue 22897 but for variables
@WalterBright created dlang/dmd pull request #13932 "fix Issue 22923 - importC: forward-declared static variable has inval…" fixing this issue: - fix Issue 22923 - importC: forward-declared static variable has invalid address https://github.com/dlang/dmd/pull/13932
dlang/dmd pull request #13932 "fix Issue 22923 - importC: forward-declared static variable has inval…" was merged into master: - 7748b7e0404af85d0ce6aa5accf4441a6d49af5a by Walter Bright: fix Issue 22923 - importC: forward-declared static variable has invalid address https://github.com/dlang/dmd/pull/13932