From ab7a5e7af6e03f512964f47d75fb90f1b0de5f54 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 13 Aug 2024 02:45:57 -0400 Subject: Proper promotion of ints --- compile.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compile.c b/compile.c index 2766143c..8f796bb2 100644 --- a/compile.c +++ b/compile.c @@ -31,6 +31,11 @@ static bool promote(env_t *env, CORD *code, type_t *actual, type_t *needed) if (!can_promote(actual, needed)) return false; + if (actual->tag == IntType && needed->tag == IntType && Match(needed, IntType)->bits == 0) { + *code = CORD_all("I(", *code, ")"); + return true; + } + if (actual->tag == IntType || actual->tag == NumType) return true; -- cgit v1.2.3