mirror of
https://github.com/golang/go
synced 2024-11-19 05:24:42 -07:00
cmd/gc: fix undefined behavior
UndefinedBehaviorSanitizer claims it is UB in C: src/cmd/gc/racewalk.c:422:37: runtime error: member access within null pointer of type 'Node' (aka 'struct Node') src/cmd/gc/racewalk.c:423:37: runtime error: member access within null pointer of type 'Node' (aka 'struct Node') LGTM=rsc R=dave, rsc CC=golang-codereviews https://golang.org/cl/125570043
This commit is contained in:
parent
99e9bac8c4
commit
1f5800673b
@ -419,8 +419,10 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
ret:
|
||||
if(n->op != OBLOCK) // OBLOCK is handled above in a special way.
|
||||
racewalklist(n->list, init);
|
||||
racewalknode(&n->ntest, &n->ntest->ninit, 0, 0);
|
||||
racewalknode(&n->nincr, &n->nincr->ninit, 0, 0);
|
||||
if(n->ntest != N)
|
||||
racewalknode(&n->ntest, &n->ntest->ninit, 0, 0);
|
||||
if(n->nincr != N)
|
||||
racewalknode(&n->nincr, &n->nincr->ninit, 0, 0);
|
||||
racewalklist(n->nbody, nil);
|
||||
racewalklist(n->nelse, nil);
|
||||
racewalklist(n->rlist, nil);
|
||||
|
Loading…
Reference in New Issue
Block a user