digitalmars.D.bugs - [Issue 22935] New: importC: offsetof with array element gives
- d-bugmail puremagic.com (24/24) Mar 25 2022 https://issues.dlang.org/show_bug.cgi?id=22935
https://issues.dlang.org/show_bug.cgi?id=22935 Issue ID: 22935 Summary: importC: offsetof with array element gives 'dereference of invalid pointer' Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: ImportC, rejects-valid Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: duser neet.fi CC: duser neet.fi using the offsetof macro from importc.h: typedef unsigned long size_t; struct S { char text[4]; }; //int tmp = __builtin_offsetof(struct S, text[0]); int tmp = ((size_t)((char *)&((struct S *)0)->text[0] - (char *)0)); Error: dereference of invalid pointer `cast(S*)0LU` the fix for issue 22809 didn't affect this --
Mar 25 2022