[Issue 22897] New: importC: segfault calling forward-declared static function through pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 18 05:02:20 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22897

          Issue ID: 22897
           Summary: importC: segfault calling forward-declared static
                    function through pointer
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Keywords: ImportC, wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi

static void other(void);
int main()
{
        void (*fn)(void) = other;
        fn();
        return 0;
}
static void other(void)
{
}

happens on linux but not windows

- direct calls work but taking the address gives an invalid pointer
- only functions that come before the body of other() are affected

--


More information about the Digitalmars-d-bugs mailing list