This test is clearly working now, since we have enabled -G=3 by default. I don't see any code in TestOutput() that disables the test. On the other hand, there is still the difference in behavior between -G=3 and -G=0 mode for the program described above. Haven't tried to narrow this down further as to when/how this was fixed.
changed the title
cmd/compile: if -G=3 fully enabled in compiler, 'go test -count=1 -race -run=TestOutput runtime/race" failsOct 28, 2021
The old compiler (-G=0) does not report an error.
The new compiler (-G=3, default) reports: p declared but not used. So does go vet.
Since go vet is reporting this error there are probably few programs in the wild that rely on gc's old behavior. It should be reasonably safe to accept the new behavior. I am leaning towards the correct behavior. Still, NeedsDecision.