Commit e7657de7 authored by Daniel Morsing's avatar Daniel Morsing

cmd/gc: avoid creating circular lists when compiling with race detector.

Fixes #5431.

R=dvyukov, remyoudompheng, rsc
CC=gobot, golang-dev
https://golang.org/cl/9910043
parent caefc5d0
......@@ -255,7 +255,11 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
// side effects are safe.
// n->right may not be executed,
// so instrumentation goes to n->right->ninit, not init.
l = nil;
// If right->ninit is non-nil, racewalknode might append it to itself.
// nil it out and handle it separately before putting it back.
l = n->right->ninit;
n->right->ninit = nil;
racewalklist(l, nil);
racewalknode(&n->right, &l, wr, 0);
appendinit(&n->right, l);
goto ret;
......
......@@ -160,3 +160,18 @@ func noRaceReturn(c chan int) (a, b int) {
}()
return a, 10
}
func issue5431() {
var p **inltype
if inlinetest(p).x && inlinetest(p).y {
} else if inlinetest(p).x || inlinetest(p).y {
}
}
type inltype struct {
x, y bool
}
func inlinetest(p **inltype) *inltype {
return *p
}
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