scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 8287e1aeccdcf88a7ac6d415ca162ccb474da3af
parent 0f0d3edeb1988957d0196482eec84366956cb574
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Sat, 31 Jan 2026 19:53:02 +0100

cc2/qbe: Fix floating point conversions

The operations were inverted and it tried to truncate when it had to
extend, and it tried to extend when it had to truncate.

Diffstat:
Msrc/cmd/scc-cc/cc2/qbe/cgen.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cmd/scc-cc/cc2/qbe/cgen.c b/src/cmd/scc-cc/cc2/qbe/cgen.c @@ -282,7 +282,7 @@ cast(Type *td, Node *np) op = i2f_conv[sidx][didx][sign]; } else { /* conversion from float to float */ - op = (didx == I4BYTES) ? ASEXTS : ASTRUNCD; + op = (didx == I4BYTES) ? ASTRUNCD : ASEXTS; } assert(op != 0);