Commit c56434f6 authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/go: don't modify input slice in gccSupportsFlag

Modifying the input slice broke the new test for whether gccgo
supports -fgo-importcfg, as the test passed a slice of the argument
slice it was in the process of building.

Fixes #22089

Change-Id: I45444a82673223c46be0c8579da3e31a74c32d73
Reviewed-on: https://go-review.googlesource.com/67191
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent bad5abf6
...@@ -3333,7 +3333,8 @@ func (b *Builder) gccSupportsFlag(compiler []string, flag string) bool { ...@@ -3333,7 +3333,8 @@ func (b *Builder) gccSupportsFlag(compiler []string, flag string) bool {
} }
b.flagCache = make(map[[2]string]bool) b.flagCache = make(map[[2]string]bool)
} }
cmdArgs := append(compiler, flag, "-c", "trivial.c") cmdArgs := append([]string(nil), compiler...)
cmdArgs = append(cmdArgs, flag, "-c", "trivial.c")
if cfg.BuildN || cfg.BuildX { if cfg.BuildN || cfg.BuildX {
b.Showcmd(b.WorkDir, "%s", joinUnambiguously(cmdArgs)) b.Showcmd(b.WorkDir, "%s", joinUnambiguously(cmdArgs))
if cfg.BuildN { if cfg.BuildN {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment