From 5ee8e1d1b0c0d9f6310d27a37a6162e0be80e413 Mon Sep 17 00:00:00 2001 From: zhangjian Date: Tue, 21 Jun 2022 16:08:47 +0000 Subject: [PATCH] compiler: in Sort_bindings return false if comparing value to itself Some versions of std::sort may pass elements at the same iterator location. Fixes golang/go#53483 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/413434 --- gcc/go/gofrontend/MERGE | 2 +- gcc/go/gofrontend/export.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 629bc66..f882812 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -6c3752315dc9b82d0f3f3ac646a1e7376818f84a +6b314f7947b4b31a86c09d166fe6664cd9968824 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/export.cc b/gcc/go/gofrontend/export.cc index a30b11a..7373dee 100644 --- a/gcc/go/gofrontend/export.cc +++ b/gcc/go/gofrontend/export.cc @@ -530,6 +530,9 @@ struct Sort_bindings bool operator()(const Named_object* n1, const Named_object* n2) const { + if (n1 == n2) + return false; + if (n1->package() != n2->package()) { if (n1->package() == NULL) -- 2.7.4