Bug 22923 – importC: forward-declared static variable has invalid address
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2022-03-25T11:27:35Z
Last change time
2022-03-31T08:12:10Z
Keywords
ImportC, pull, wrong-code
Assigned to
No Owner
Creator
duser
Comments
Comment #0 by duser — 2022-03-25T11:27:35Z
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
Comment #1 by dlang-bot — 2022-03-31T06:53:36Z
@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
Comment #2 by dlang-bot — 2022-03-31T08:12:10Z
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