From: Ian Lance Taylor Date: Fri, 10 Sep 2021 18:14:25 +0000 (-0700) Subject: compiler: correct condition for calling memclrHasPointers X-Git-Tag: releases/gcc-11.3.0~916 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7edb992d8195572e2c823fedab319eb6cb2f0f32;p=thirdparty%2Fgcc.git 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 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/344189 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 6375922dac12..de8399f8231f 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -9169,7 +9169,7 @@ Builtin_call_expression::flatten_append(Gogo* gogo, Named_object* function, 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