public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Correct condition for calling memclrHasPointers
@ 2021-09-10 18:15 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2021-09-10 18:15 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

This Go frontend patch corrects the condition under which we call
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.  This fixes https://golang.org/issue/47771.  Bootstrapped
and ran Go tests on x86_64-pc-linux-gnu.  Committed to trunk and to
GCC 10 and 11 branches.

Ian

patch.txt

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1114 bytes --]

62749196c08af5619c386d78609def261e93b507
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index c3772694780..ff41af787b1 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-e42c7c0216aec70834e8827174458aa4a50169fa
+21b30eddc59d92a07264c3b21eb032d6c303d16f
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 8d4d168f4e3..ddb1d91f3e5 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -9350,7 +9350,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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-10 18:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 18:15 Go patch committed: Correct condition for calling memclrHasPointers Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).