diff options
| author | 2025-12-10 11:42:33 +0100 | |
|---|---|---|
| committer | 2025-12-10 11:43:12 +0100 | |
| commit | 1ada32d3a8bee5533cab63f17c4402a20b1b8e23 (patch) | |
| tree | 03c46c47dcad7b05dfa38a6b2f53a11f882bdd67 /c | |
| parent | 15cf067c4e65c1728c48ab049d48219daa436265 (diff) | |
c: fix compound assignment type conversions when types don't match
Diffstat (limited to 'c')
| -rw-r--r-- | c/c.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3484,8 +3484,9 @@ compileexpr(struct function *fn, const struct expr *ex, bool discard) l = genload(fn, ex->ty, adr, ex->qual & QVOLATILE); if ((op != Oadd && op != Osub) || cls != KPTR) { l = cvt(fn, ty, sub[0].ty, l); - r = cvt(fn, ex->ty, sub[1].ty, r); - q = irbinop(fn, op, cls, l, r); + r = cvt(fn, ty, sub[1].ty, r); + q = irbinop(fn, op, type2cls[ty.t], l, r); + q = cvt(fn, ex->ty, ty, q); } else { q = genptroff(fn, op, typesize(typechild(ex->ty)), l, sub[1].ty, r); } |