aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/builtin.c
diff options
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin.c b/builtin.c
index 8e1d2d7e..3a29c3ae 100644
--- a/builtin.c
+++ b/builtin.c
@@ -546,11 +546,19 @@ static int expand_object_size(struct expression *expr, int cost)
// a deref is just intermediate variable
// and so the offset needs to be zeroed.
if (arg->op == '*') {
+ struct expression *parent = arg;
arg = arg->unop;
off = 0;
switch (arg->type) {
case EXPR_SYMBOL:
arg = arg->symbol->initializer;
+ if (arg == parent) {
+ // stop at self-initialized vars
+ // and do not expand them.
+ arg = NULL;
+ val = -1;
+ break;
+ }
continue;
default:
break;