From f89b39c0af0c91d564266a0f7cb7bb9e52f28038 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 22 Nov 2022 13:28:51 -0500 Subject: [PATCH] cmd/compile: reenable inlstaticinit This was disabled in CL 452676 out of an abundance of caution, but further analysis has shown that the failures were not being caused by this optimization. Instead the sequence of commits was: CL 450136 cmd/compile: handle simple inlined calls in staticinit ... CL 449937 archive/tar, archive/zip: return ErrInsecurePath for unsafe paths ... CL 451555 cmd/compile: fix static init for inlined calls The failures in question became compile failures in the first CL and started building again after the last CL. But in the interim the code had been broken by the middle CL. CL 451555 was just the first time that the tests could run and fail. For #30820. Change-Id: I65064032355b56fdb43d9731be2f9f32ef6ee600 Reviewed-on: https://go-review.googlesource.com/c/go/+/452817 Reviewed-by: Cuong Manh Le Reviewed-by: Cherry Mui Reviewed-by: Matthew Dempsky Run-TryBot: Russ Cox Auto-Submit: Russ Cox TryBot-Result: Gopher Robot --- src/cmd/compile/internal/base/debug.go | 2 +- src/cmd/compile/internal/base/flag.go | 2 +- test/fixedbugs/issue56778.go | 2 +- test/inline.go | 2 +- test/noinit.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cmd/compile/internal/base/debug.go b/src/cmd/compile/internal/base/debug.go index 4667fdb1da..ee42696ad2 100644 --- a/src/cmd/compile/internal/base/debug.go +++ b/src/cmd/compile/internal/base/debug.go @@ -31,7 +31,7 @@ type DebugFlags struct { GCProg int `help:"print dump of GC programs"` Gossahash string `help:"hash value for use in debugging the compiler"` InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"` - InlStaticInit int `help:"allow static initialization of inlined calls"` + InlStaticInit int `help:"allow static initialization of inlined calls" concurrent:"ok"` InterfaceCycles int `help:"allow anonymous interface cycles"` Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"` LocationLists int `help:"print information about DWARF location list creation"` diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go index 1546c277fd..8cb7e96d14 100644 --- a/src/cmd/compile/internal/base/flag.go +++ b/src/cmd/compile/internal/base/flag.go @@ -167,7 +167,7 @@ func ParseFlags() { Debug.ConcurrentOk = true Debug.InlFuncsWithClosures = 1 - Debug.InlStaticInit = 0 + Debug.InlStaticInit = 1 if buildcfg.Experiment.Unified { Debug.Unified = 1 } diff --git a/test/fixedbugs/issue56778.go b/test/fixedbugs/issue56778.go index 3c27501fd2..8bb5c3e213 100644 --- a/test/fixedbugs/issue56778.go +++ b/test/fixedbugs/issue56778.go @@ -1,4 +1,4 @@ -// compiledir -d=inlstaticinit=1 +// compiledir // Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/inline.go b/test/inline.go index 1aa8fccbbd..cf2cd8cd60 100644 --- a/test/inline.go +++ b/test/inline.go @@ -1,4 +1,4 @@ -// errorcheckwithauto -0 -m -d=inlfuncswithclosures=1 -d=inlstaticinit=1 +// errorcheckwithauto -0 -m -d=inlfuncswithclosures=1 // Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/noinit.go b/test/noinit.go index 505467cf8f..ed8e572e51 100644 --- a/test/noinit.go +++ b/test/noinit.go @@ -1,4 +1,4 @@ -// run -gcflags=-d=inlstaticinit=1 +// run //go:build !gcflags_noopt // Copyright 2010 The Go Authors. All rights reserved.