aboutsummaryrefslogtreecommitdiffhomepage
path: root/c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-20 20:41:48 +0100
committerlemon <lsof@mailbox.org>2025-12-20 20:41:48 +0100
commitc0dcd732339bed30fed759388f5c7dad83ff8453 (patch)
tree575530e33d67f19a9fca3cdf5fc2493eff4c34b2 /c
parent01e015fcc717c01c17a7cfcae3a5db8248567051 (diff)
c: small typechecking bugfixes
Diffstat (limited to 'c')
-rw-r--r--c/c.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/c/c.c b/c/c.c
index 249c009..492b537 100644
--- a/c/c.c
+++ b/c/c.c
@@ -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);
}