harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3f0e36cf9eb59146d02c7b2c22e23385e02e9a61
parent fa2b3a43dd98f64d34ec4024aab48dad84798a14
Author: Drew DeVault <sir@cmpwn.com>
Date:   Mon,  1 Feb 2021 08:57:19 -0500

eval: fix issues with casting & enum constants

Diffstat:
Msrc/eval.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/eval.c b/src/eval.c @@ -228,7 +228,7 @@ eval_const(struct context *ctx, struct expression *in, struct expression *out) storage = type_dealias(out->result)->_enum.storage; } struct array_constant **next; - switch (type_dealias(out->result)->storage) { + switch (storage) { case TYPE_STORAGE_ALIAS: case TYPE_STORAGE_ENUM: assert(0); // Handled above @@ -324,7 +324,7 @@ eval_cast(struct context *ctx, struct expression *in, struct expression *out) case TYPE_STORAGE_UINT: case TYPE_STORAGE_UINTPTR: case TYPE_STORAGE_SIZE: - out->constant.uval = itrunc(to, in->constant.uval); + out->constant.uval = itrunc(to, val.constant.uval); return EVAL_OK; case TYPE_STORAGE_ARRAY: case TYPE_STORAGE_SLICE: