Gcc assumes sizeof(void) being 1. Currently sparse would generate wrong code for: void *test(void *p) { p++; return p; } unsigned long test1(void *p) { return sizeof(*p); } .L0x2b48867c1010: <entry-point> add.32 %r2 <- %arg1, $-1 ret.32 %r2 test1: .L0x2b48867c10b0: <entry-point> ret.32 $-1 And with bit_size set to &bits_in_char, the code looks as expected. Signed-off-by: Alexey Zaytsev <alexey.zaytsev@xxxxxxxxx> --- symbol.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/symbol.c b/symbol.c index 4da253b..02844cf 100644 --- a/symbol.c +++ b/symbol.c @@ -834,7 +834,7 @@ static const struct ctype_declare { struct symbol *base_type; } ctype_declaration[] = { { &bool_ctype, SYM_BASETYPE, MOD_UNSIGNED, &bits_in_bool, &max_int_alignment, &int_type }, - { &void_ctype, SYM_BASETYPE, 0, NULL, NULL, NULL }, + { &void_ctype, SYM_BASETYPE, 0, &bits_in_char, NULL, NULL }, { &type_ctype, SYM_BASETYPE, MOD_TYPE, NULL, NULL, NULL }, { &incomplete_ctype,SYM_BASETYPE, 0, NULL, NULL, NULL }, { &bad_ctype, SYM_BASETYPE, 0, NULL, NULL, NULL }, -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html