The test checks for "-fm" in runtime.Stack output to detect Go method
value wrappers. However, strings.Contains(s, "-fm") also matches the
substring in build directory paths (e.g. /path/to/gcc-fmo/...), causing
a spurious failure.
Check for "-fm" followed by a line terminator (\n or \r) or an opening
parenthesis instead. gccgo emits bare function names followed by a
newline, while the standard gc compiler emits function names with a
parameter list (e.g. "main.Func.Bar-fm(...)"), so the "(" check covers
the gc format.
gcc/testsuite/ChangeLog:
* go.test/test/fixedbugs/issue24488.go: Match "-fm" followed by
a line terminator or "(" instead of bare "-fm" to avoid false
positives from build paths.
---
gcc/testsuite/go.test/test/fixedbugs/issue24488.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue24488.go
b/gcc/testsuite/go.test/test/fixedbugs/issue24488.go
index b3deab48228d..0070e3ad17e3 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/issue24488.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/issue24488.go
@@ -26,7 +26,9 @@ func (f Func) Bar() {
buf := make([]byte, 4000)
n := runtime.Stack(buf, true)
s := string(buf[:n])
- if strings.Contains(s, "-fm") {
+ if strings.Contains(s, "-fm\n") ||
+ strings.Contains(s, "-fm\r") ||
+ strings.Contains(s, "-fm(") {
panic("wrapper present in stack trace:\n" + s)
}
}
--
2.52.0