commit 408069b686f5db03f2ede95ef7e703ce40b8d3ff
parent ba0b2937f7725f03722c95bfb7772cba9e4ffb2f
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:
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);