Created attachment 14856 [details] Use with gdb to demonstrate bug. When the last element of a C language struct is a zero length array, the evaluation of sizeof(*(struct S*)pointer) does not match sizeof(struct S). > Breakpoint 1, fn (ps=0x7fffffffe250) at demo-sizeof-bug.c:15 > 15 printf("ps = %p\n", ps); > (gdb) p sizeof(*ps) > $1 = 7 > (gdb) p sizeof(struct S) > $2 = 8 > (gdb) ptype/o *ps > /* offset | size */ type = struct S { > /* 0 | 4 */ int32_t f1; > /* 4 | 2 */ int16_t f2; > /* 6 | 1 */ int8_t f3; > /* 7 | 0 */ int8_t f4[]; > /* total size (bytes): 7 */