[Issue 22935] New: importC: offsetof with array element gives 'dereference of invalid pointer'
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 25 15:36:16 UTC 2022
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 at puremagic.com
Reporter: duser at neet.fi
CC: duser at 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
--
More information about the Digitalmars-d-bugs
mailing list