https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91764
Bug ID: 91764 Summary: [10 regression] libgo build broken with Solaris grep Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: go Assignee: ian at airs dot com Reporter: ro at gcc dot gnu.org CC: cmang at google dot com Target Milestone: --- Target: *-*-solaris2.11 When I first tried to bootstrap on Solaris 11.3 after the Go 1.13 import, bootstrap was broken building libgo. This can be seen e.g. building internal/cpu: the .dep file is created with /usr/gnu/bin/mkdir -p internal; files=`echo /vol/gcc/src/hg/trunk/local/libgo/go /internal/cpu/cpu.go /vol/gcc/src/hg/trunk/local/libgo/go/internal/cpu/cpu_386.g o /vol/gcc/src/hg/trunk/local/libgo/go/internal/cpu/cpu_no_init.go /vol/gcc/src/ hg/trunk/local/libgo/go/internal/cpu/cpu_ppc64x.go /vol/gcc/src/hg/trunk/local/l ibgo/go/internal/cpu/cpu_x86.go cpugen.go which includes quite a number of files that shouldn't be there due to build tags (like cpu_no_init.go and cpu_ppc64x.go on i386-pc-solaris2.11). This leads to compilation failures like /vol/gcc/src/hg/trunk/local/libgo/go/internal/cpu/cpu_ppc64x.go:27:1: error: redefinition of 'doinit' 27 | func doinit() { | ^ /vol/gcc/src/hg/trunk/local/libgo/go/internal/cpu/cpu_no_init.go:16:1: note: previous definition of 'doinit' was here 16 | func doinit() { | ^ /vol/gcc/src/hg/trunk/local/libgo/go/internal/cpu/cpu_x86.go:39:1: error: redefinition of 'doinit' 39 | func doinit() { | ^ and many more which turns out to be due to this change: diff --git a/libgo/match.sh b/libgo/match.sh --- a/libgo/match.sh +++ b/libgo/match.sh @@ -135,7 +135,7 @@ for f in $gofiles; do if test x$tag1 != xnonmatchingtag -a x$tag2 != xnonmatchingtag; then # Pipe through cat so that `set -e` doesn't affect fgrep. - tags=`sed '/^package /q' < $f | grep '^// +build ' | cat` + tags=`sed '/^package /q' < $f | grep '^// \?+build ' | cat` [...] @@ -143,7 +143,7 @@ for f in $gofiles; do case $tag in "//") ;; - "+build") + "+build" | "//+build") While the old form of the RE (^// +build ) matches the build tags with both Solaris grep (/bin/grep) and GNU grep, the second form only works with GNU grep, effectively breaking build tags. For the moment, I've worked around this by installing GNU grep, but there should be a better way, especially given that this has worked correctly for years.