diff options
| author | 2025-12-20 20:41:48 +0100 | |
|---|---|---|
| committer | 2025-12-20 20:41:48 +0100 | |
| commit | c0dcd732339bed30fed759388f5c7dad83ff8453 (patch) | |
| tree | 575530e33d67f19a9fca3cdf5fc2493eff4c34b2 /c | |
| parent | 01e015fcc717c01c17a7cfcae3a5db8248567051 (diff) | |
c: small typechecking bugfixes
Diffstat (limited to 'c')
| -rw-r--r-- | c/c.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -438,7 +438,7 @@ subscriptcheck(const struct expr *ex, const struct expr *rhs, const struct span { union type ty; if (ex->ty.t == TYPTR || ex->ty.t == TYARRAY) { - if (isincomplete(ty = typechild(ex->ty))) { + if (isincomplete(typedecay(ty = typechild(ex->ty)))) { error(span, "cannot dereference pointer to incomplete type '%ty'", ty); ty = mktype(TYINT); } else if (ty.t == TYFUNC) { @@ -1109,7 +1109,7 @@ Unary: case '*': if (ex.ty.t == TYPTR || ex.ty.t == TYARRAY) { ty = typechild(ex.ty); - if (isincomplete(ty)) { + if (isincomplete(typedecay(ty))) { error(&span, "cannot dereference pointer to incomplete type '%ty'", ty); ty = mktype(TYINT); } @@ -1736,7 +1736,7 @@ initializer(struct comp *cm, union type *ty, enum evalmode ev, bool globl, return ex; } - assert(countof(res.zero) == 1); + assert(countof(res.zero) == BSSIZE(64)); if (ev != EVSTATICINI) { memset(res.zero, 0xFF, sizeof res.zero); } |