commit 54a2622a7aa6c71d01313f79d0e5d3e9ed6f5091
parent 760a97b7a87c9de2ed02f89fba5319f880573652
Author: Eyal Sawady <ecs@d2evs.net>
Date: Thu, 18 Mar 2021 00:35:38 -0400
Fix dereferencing of aliases of pointers
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -2441,15 +2441,16 @@ check_expr_unarithm(struct context *ctx,
ctx->store, operand->result, 0);
break;
case UN_DEREF:
- if (operand->result->storage != STORAGE_POINTER) {
+ if (type_dealias(operand->result)->storage != STORAGE_POINTER) {
return error(aexpr->unarithm.operand->loc, expr, errors,
"Cannot de-reference non-pointer type");
}
- if (operand->result->pointer.flags & PTR_NULLABLE) {
+ if (type_dealias(operand->result)->pointer.flags
+ & PTR_NULLABLE) {
return error(aexpr->unarithm.operand->loc, expr, errors,
"Cannot dereference nullable pointer type");
}
- expr->result = operand->result->pointer.referent;
+ expr->result = type_dealias(operand->result)->pointer.referent;
break;
}