scc

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

commit db2067f57cf7f2cf6ac71e28db1b77212a4a560c
parent d7a103eb62390bfb54a702d7191d6bcd2c8bee4a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 14 Mar 2022 19:31:12 +0100

cc2-qbe: Call sethi() for subops

When nodes are created because there are abbreviations we must
set the sethi numbers that drive the code generation, otherwise
we can have unexpected results.

Diffstat:
Msrc/cmd/cc/cc2/target/qbe/cgen.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/cmd/cc/cc2/target/qbe/cgen.c b/src/cmd/cc/cc2/target/qbe/cgen.c @@ -534,7 +534,7 @@ assign(Node *np) aux.left = ret; aux.right = r; aux.type = np->type; - r = rhs(&aux); + r = rhs(sethi(&aux)); break; default: /* assign abbreviation */ @@ -542,7 +542,8 @@ assign(Node *np) aux.left = l; aux.right = r; aux.type = np->type; - r = complex(&aux); + aux.address = np->address; + r = sethi(&aux); case 0: if (l->complex >= r->complex) { l = lhs(l);