aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-19 12:58:03 +0100
committerlemon <lsof@mailbox.org>2025-12-19 12:58:03 +0100
commit13b158caadb1d649101f9ea4c865fc67daba22d5 (patch)
treeeb339fe466d0b201f765cacb99e5c744444bf961
parent95c43247e02b12c86114d53e95eec2c4988a9e03 (diff)
c: fix incr/decr codegen for floats
-rw-r--r--c/c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/c/c.c b/c/c.c
index 1cc37e0..9c78915 100644
--- a/c/c.c
+++ b/c/c.c
@@ -3441,7 +3441,7 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard)
if (ex->ty.t == TYPTR)
r = mkintcon(type2cls[targ_sizetype], typesize(typechild(ex->ty)));
else
- r = mkref(RICON, 1);
+ r = isflt(ex->ty) ? mkfltcon(type2cls[ex->ty.t], 1.0) : mkref(RICON, 1);
bitsiz = 0;
if (sub[0].t == EGETF && (bitsiz = sub->fld.bitsiz)) {
union ref tmp;
@@ -3462,7 +3462,7 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard)
if (ex->ty.t == TYPTR)
r = mkintcon(type2cls[targ_sizetype], typesize(typechild(ex->ty)));
else
- r = mkref(RICON, 1);
+ r = isflt(ex->ty) ? mkfltcon(type2cls[ex->ty.t], 1.0) : mkref(RICON, 1);
if (sub[0].t == EGETF && (bitsiz = sub->fld.bitsiz)) {
ty = ex->ty;
goto CompoundBitf;