diff options
author | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2008-12-18 20:22:27 +0300 |
---|---|---|
committer | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2008-12-18 21:11:00 +0300 |
commit | e3bff51f8a10eeb65f5bb06ca0441291b2bf63e9 (patch) | |
tree | 432f923fbd93a5423735c38559122f512fbec287 /symbol.c | |
parent | Rename dirafter to idirafter. (diff) | |
download | sparse-e3bff51f8a10eeb65f5bb06ca0441291b2bf63e9.tar.gz sparse-e3bff51f8a10eeb65f5bb06ca0441291b2bf63e9.tar.bz2 sparse-e3bff51f8a10eeb65f5bb06ca0441291b2bf63e9.zip |
Let void have sizeof 1
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@gmail.com>
Diffstat (limited to 'symbol.c')
-rw-r--r-- | symbol.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 }, |