diff options
| author | 2023-06-08 11:02:25 +0200 | |
|---|---|---|
| committer | 2023-06-08 11:02:25 +0200 | |
| commit | 22e20cf906fa3904eedfe34efc58a7b56116ce42 (patch) | |
| tree | 2a14de98971d30e640908609bbadd2392efc1ad9 | |
| parent | 86625b1166bd39e28b4dd4995ed6cd88c0bdde7e (diff) | |
pointer arith bugifx
| -rw-r--r-- | parse.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -294,6 +294,7 @@ argpromote(union type t) { if (isint(t)) t.t = intpromote(t.t); else if (t.t == TYFLOAT) t.t = TYDOUBLE; + else if (t.t == TYARRAY) return mkptrtype(typechild(t), t.flag & TFCHLDQUAL); return t; } @@ -499,7 +500,7 @@ bintypecheck(const struct span *span, enum toktag tt, struct expr *lhs, struct e /* num +/- num */ ty = cvtarith(ty, rhs->ty); assert(ty.t); - } else if ((ty.t == TYPTR || ty.t == TYARRAY) && rhs->ty.t == TYINT) { + } else if ((ty.t == TYPTR || ty.t == TYARRAY) && isint(rhs->ty)) { /* ptr +/- int */ union type pointee = typechild(ty); if (isincomplete(pointee)) |