diff options
| author | 2026-04-09 14:04:45 +0200 | |
|---|---|---|
| committer | 2026-04-09 14:05:31 +0200 | |
| commit | 3dd91560a2dca691953a5691e96787adeeb509d5 (patch) | |
| tree | 68f1f2b63436c6e92a00d665b850485f6990e490 /src/ir.c | |
| parent | 7355aa3e9e88b7236fc86226b50ce820c7ff5220 (diff) | |
mkintcon: bugfix clamp i32 to i32 range
Diffstat (limited to 'src/ir.c')
| -rw-r--r-- | src/ir.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -136,12 +136,14 @@ mkirtype(Type t) Ref mkintcon(enum irclass k, s64int i) { + if (cls2siz[k] == 4) { /* check upper half is zero or -1 */ + assert(in_range((i >> 32) + 1, 0, 1)); + i = (int)i; + } if (i < 1l << 28 && i >= -(1l << 28)) { return mkref(RICON, i); } else { IRCon con = { .cls = k, .i = i }; - if (cls2siz[k] == 4) /* check upper half is zero or -1 */ - assert(in_range((i >> 32) + 1, 0, 1)); return newxcon(&con); } } |