digitalmars.D.bugs - [Issue 22592] New: importC: Segmentation fault indexing global array
- d-bugmail puremagic.com (34/34) Dec 12 2021 https://issues.dlang.org/show_bug.cgi?id=22592
https://issues.dlang.org/show_bug.cgi?id=22592 Issue ID: 22592 Summary: importC: Segmentation fault indexing global array at run-time Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: ibuclaw gdcproject.org Compile with -betterC and run the resultant executable. --- /* Comment out the next line to make the segfault go away. */ int testfn (void); typedef struct config_s { short field; } config; static const config table[10] = { {0}, {4}, {5}, {6}, {4}, {16}, {16}, {32}, {128}, {258} }; int testfn () { return table[6].field; } int main() { testfn(); } --- --
Dec 12 2021