((d-sel (ident ,field) ,struct)
(let ((type0 (ast->type struct info)))
- (stderr "type0=~s\n" type0)
(ast->type (field-type info type0 field) info)))
((i-sel (ident ,field) ,struct)
(* (expr->number info a) (expr->number info b)))
((sub ,a ,b)
(- (expr->number info a) (expr->number info b)))
- ((sizeof-type (type-name (decl-spec-list (type-spec ,type))))
- (ast-type->size info type))
- ((sizeof-expr (d-sel (ident ,field) (p-expr (ident ,struct))))
- (let ((type (ident->type info struct)))
- (field-size info type field)))
- ((sizeof-expr (i-sel (ident ,field) (p-expr (ident ,struct))))
- (let ((type (ident->type info struct)))
- (field-size info type field)))
+ ((sizeof-type ,type)
+ (->size (ast->type type info)))
+ ((sizeof-expr ,expr)
+ (->size (ast->type expr info)))
((lshift ,x ,y)
(ash (expr->number info x) (expr->number info y)))
((rshift ,x ,y)
char *list[2] = {"foo\n", "bar\n"};
struct foo {int length; char* string;};
-struct foo f = {3, "foo"};
+struct foo g_f = {3, "foo"};
+struct foo g_g = &g_f;
struct foo g_foes[2];
int g_foe;
int
test (struct foo* p)
{
- struct foo *g = &f;
+ struct foo *g = &g_f;
g[0].length = 0;
p[0].length = 0;
}
return 14;
if (env[3])
return 15;
- if (f.length != 3)
+ if (g_f.length != 3)
return 16;
- if (strcmp (f.string, "foo"))
+ if (strcmp (g_f.string, "foo"))
return 17;
struct foo g = {4, "baar"};
if (g.length != 4)
if (u.foo != 3) return 24;
if (u.bla != 4) return 25;
+ char buf[sizeof (g_f.string)];
+ char buf1[sizeof (g_g->string)];
+
i = 1;
int lst[6] = {-1, 1 - 1, i, 2, 3};
for (int i = 0; i < 4; i++)