Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link/internal/ld: loop-variable aliasing in TestDeadcode #38884

Closed
bcmills opened this issue May 5, 2020 · 1 comment
Closed

cmd/link/internal/ld: loop-variable aliasing in TestDeadcode #38884

bcmills opened this issue May 5, 2020 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented May 5, 2020

2020-05-05T15:41:37-b4ecafc/plan9-arm
2020-05-05T05:13:26-9b18968/plan9-arm
2020-05-05T00:36:44-c9d5f60/plan9-arm
2020-05-04T17:40:00-a1ffbe9/plan9-arm

--- FAIL: TestDeadcode (0.00s)
    --- FAIL: TestDeadcode/reflectcall (4.47s)
        deadcode_test.go:42: [/boot/workdir/go/bin/go build -ldflags=-dumpdep -o /tmp/TestDeadcode160913525/typedesc.exe testdata/deadcode/typedesc.go]: exit status: 'go 42246: 1':
            # command-line-arguments
            _ -> _rt0_arm_plan9
            _rt0_arm_plan9 -> runtime.rt0_go
            _rt0_arm_plan9 -> _tos
            runtime.rt0_go -> runtime.emptyfunc
…
            type..eqfunc.[4]string -> type..eq.[4]string
            go build command-line-arguments: copying /tmp/go-build094893182/b001/exe/a.out to /tmp/TestDeadcode160913525/typedesc.exe: write /tmp/TestDeadcode160913525/typedesc.exe: file does not exist
FAIL
FAIL	cmd/link/internal/ld	4.628s

Looking at the related CL 231397, I notice the following fragment:

	for _, test := range tests {
		t.Run(test.src, func(t *testing.T) {
			t.Parallel()
			src := filepath.Join("testdata", "deadcode", test.src+".go")
			exe := filepath.Join(tmpdir, test.src+".exe")

The uses of test.src end up colliding, with the same file used in every subtest. (This is exactly the situation described in #35670.)

@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels May 5, 2020
@bcmills bcmills added this to the Go1.15 milestone May 5, 2020
@gopherbot
Copy link

Change https://golang.org/cl/232377 mentions this issue: cmd/link: fix loop variable capturing in TestDeadcode

xujianhai666 pushed a commit to xujianhai666/go-1 that referenced this issue May 21, 2020
Fixes golang#38884.

Change-Id: Id5ab9977b6404d0dbf71f13e3e4fefb6868ac802
Reviewed-on: https://go-review.googlesource.com/c/go/+/232377
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

3 participants