This patch by zhangjian to the Go frontend changes Sort_bindings to return false if comparing a value to itself. Apparently some versions of std::sort may pass elements at the same iterator location. This fixes https://go.dev/issue/53483. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
5ee8e1d1b0c0d9f6310d27a37a6162e0be80e413 diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 629bc666dc0..f882812d219 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 a30b11af31e..7373deee310 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)