compiler: correct condition for calling memclrHasPointers
When compiling append(s, make([]typ, ln)...), where typ has a pointer,
and the append fits within the existing capacity of s, the condition
used to clear out the new elements was reversed.
Fixes golang/go#47771
Change-Id: Ia880adc08ab723afe3f927e65c9e081f9f717f90
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/344189
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc
index 8d4d168..ddb1d91 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -9350,7 +9350,7 @@
ref2 = Expression::make_cast(uint_type, ref2, loc);
cond = Expression::make_binary(OPERATOR_GT, ref, ref2, loc);
zero = Expression::make_integer_ul(0, int_type, loc);
- call = Expression::make_conditional(cond, call, zero, loc);
+ call = Expression::make_conditional(cond, zero, call, loc);
}
}
else