aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Zaytsev <alexey.zaytsev@gmail.com>2008-12-18 20:22:27 +0300
committerAlexey Zaytsev <alexey.zaytsev@gmail.com>2008-12-18 21:11:00 +0300
commite3bff51f8a10eeb65f5bb06ca0441291b2bf63e9 (patch)
tree432f923fbd93a5423735c38559122f512fbec287
parent5cba08a5cf79205e324f4c50d3a58177693bdf92 (diff)
downloadsparse-master.tar.gz
sparse-master.tar.xz
sparse-master.zip
Let void have sizeof 1HEADmaster
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>
-rw-r--r--symbol.c2
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 },