public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
	 gofrontend-dev <gofrontend-dev@googlegroups.com>
Subject: libgo patch committed: Add benchmarks and examples to test list
Date: Fri, 16 Jun 2023 12:30:26 -0700	[thread overview]
Message-ID: <CAOyqgcUQMgax3RS-nT0ac+J+7ZFqJ-BZEF-200SmHDWtxagL1w@mail.gmail.com> (raw)

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

In https://go.dev/cl/384695
(https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590289.html)
I simplified the code that built lists of benchmarks, examples, and
fuzz tests, and managed to break it. This patch corrects the code to
once again make the benchmarks available, and to run the examples with
output and the fuzz targets.

Doing this revealed a test failure in internal/fuzz on 32-bit x86: a
signalling NaN is turned into a quiet NaN on the 387 floating-point
stack that GCC uses by default. This CL skips the test.

This fixes https://go.dev/issue/60826.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

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

bc6bd0d608da1609c1caeb04ab795a83720add55
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 702257009d2..1191a8d663d 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-737de90a63002d4872b19772a7116404ee5815b4
+a3a3c3a2d1bc6a8ca51b302d08c94ef27cdd8f0f
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/libgo/go/internal/fuzz/encoding_test.go b/libgo/go/internal/fuzz/encoding_test.go
index 8e3800eb77f..53fc5b8dc71 100644
--- a/libgo/go/internal/fuzz/encoding_test.go
+++ b/libgo/go/internal/fuzz/encoding_test.go
@@ -6,6 +6,7 @@ package fuzz
 
 import (
 	"math"
+	"runtime"
 	"strconv"
 	"testing"
 	"unicode"
@@ -330,6 +331,14 @@ func FuzzFloat64RoundTrip(f *testing.F) {
 	f.Add(math.Float64bits(math.Inf(-1)))
 
 	f.Fuzz(func(t *testing.T, u1 uint64) {
+		// The signaling NaN test fails on 32-bit x86 with gccgo,
+		// which uses the 387 floating-point stack by default.
+		// Converting a signaling NaN in and out of the stack
+		// changes the NaN to a quiet NaN.
+		if runtime.GOARCH == "386" && u1 == 0x7FF0000000000001 {
+			t.Skip("skipping signalling NaN test on 386 with gccgo")
+		}
+
 		x1 := math.Float64frombits(u1)
 
 		b := marshalCorpusFile(x1)
diff --git a/libgo/testsuite/gotest b/libgo/testsuite/gotest
index 0a0a7e14d74..33c98d804d6 100755
--- a/libgo/testsuite/gotest
+++ b/libgo/testsuite/gotest
@@ -577,13 +577,13 @@ symtogo() {
 # Find Go benchmark/fuzz/example functions.
 # The argument is the function name prefix.
 findfuncs() {
-	pattern='$1([^a-z].*)?'
+	pattern="$1([^a-z].*)?"
 	syms=$($NM -p -v _gotest_.o | egrep " $text .*\."$pattern'$' | fgrep -v ' __go_' | egrep -v '\.\.\w+$' | sed 's/.* //')
 	if $havex; then
 	    xsyms=$($NM -p -v $xofile | egrep " $text .*\."$pattern'$' | fgrep -v ' __go_' | egrep -v '\.\.\w+$' | sed 's/.* //')
 	    syms="$syms $xsyms"
 	fi
-        $(symtogo "$benchmarksyms")
+        symtogo "$syms"
 }
 
 # Takes an example name and puts any output into the file example.txt.
@@ -643,11 +643,13 @@ exampleoutput() {
 	fi
 	if $havex; then
 	    needxtest=false
-	    if test -n "$testxsyms" -o -n "$benchmarkxsyms"; then
+	    if test -n "$testxsyms"; then
+		needxtest=true
+	    elif echo "$benchmarks" | grep '_test\.' >/dev/null; then
 		needxtest=true
 	    else
 		# Check whether any example has output.
-		for i in $(symtogo "$examplexsyms"); do
+		for i in $(echo "$examples" | grep '_test\.'); do
 		    exampleoutput $i
 		    if test -f example.txt; then
 			rm -f example.txt

                 reply	other threads:[~2023-06-16 19:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOyqgcUQMgax3RS-nT0ac+J+7ZFqJ-BZEF-200SmHDWtxagL1w@mail.gmail.com \
    --to=iant@golang.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).