diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-13 02:45:57 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-13 02:45:57 -0400 |
| commit | ab7a5e7af6e03f512964f47d75fb90f1b0de5f54 (patch) | |
| tree | 1a18d95fac96ae83ab785aa06c08077a2b68cd62 | |
| parent | 9b9087bfef72417b4930512d33103d9a5a748cd8 (diff) | |
Proper promotion of ints
| -rw-r--r-- | compile.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; |
