Skip to content

Commit 2399302

Browse files
committed
cmd/compile/internal/base: keep Ctxt.Flag_optimize in sync with Flag.N
This patch fixes an inconsistency in compiler flag handling introduced accidentally in CL 521699. In the compiler we have both base.Flag.N (which records whether the user has supplied the "-N" flag to disable optimization) and base.Ctxt.Flag_optimize (which tracks whether optimization is turned on). In this case Flag.N was updated without a corresponding change to Ctxt.Flag_optimize, which led to problems with DWARF generation for the runtime. This CL doesn't include a regression test; a test will be added later in the x/debug repo in a subsequent CL. Updates #62523. Change-Id: I0c383bb43ec0a0e7c12e7e2852c0590731416d6f Reviewed-on: https://go-review.googlesource.com/c/go/+/527319 Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Alessandro Arzilli <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 94200bf commit 2399302

File tree

1 file changed

+1
-0
lines changed
  • src/cmd/compile/internal/base

1 file changed

+1
-0
lines changed

src/cmd/compile/internal/base/flag.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ func ParseFlags() {
334334
// It is not possible to build the runtime with no optimizations,
335335
// because the compiler cannot eliminate enough write barriers.
336336
Flag.N = 0
337+
Ctxt.Flag_optimize = true
337338

338339
// Runtime can't use -d=checkptr, at least not yet.
339340
Debug.Checkptr = 0

0 commit comments

Comments
 (0)