www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22923] New: importC: forward-declared static variable has


          Issue ID: 22923
           Summary: importC: forward-declared static variable has invalid
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Keywords: ImportC, wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

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

Mar 25 2022