dump("r", n);
dump("res", res);
}
- if(w == 0)
- return;
if(w < 0)
fatal("sgen copy %d", w);
if(n->ullman >= UINF && res->ullman >= UINF)
if(n->type == T)
fatal("sgen: missing type");
+ if(w == 0) {
+ // evaluate side effects only.
+ regalloc(&dst, types[tptr], N);
+ agen(res, &dst);
+ agen(n, &dst);
+ regfree(&dst);
+ return;
+ }
+
// determine alignment.
// want to avoid unaligned access, so have to use
// smaller operations for less aligned types.
dump("r", n);
dump("res", ns);
}
- if(w == 0)
- return;
- if(n->ullman >= UINF && ns->ullman >= UINF) {
+
+ if(n->ullman >= UINF && ns->ullman >= UINF)
fatal("sgen UINF");
- }
if(w < 0)
fatal("sgen copy %d", w);
if(w == 16)
if(componentgen(n, ns))
return;
+
+ if(w == 0) {
+ // evaluate side effects only
+ regalloc(&nodr, types[tptr], N);
+ agen(ns, &nodr);
+ agen(n, &nodr);
+ regfree(&nodr);
+ return;
+ }
// offset on the stack
osrc = stkof(n);
dump("r", n);
dump("res", res);
}
- if(w == 0)
- return;
- if(n->ullman >= UINF && res->ullman >= UINF) {
+ if(n->ullman >= UINF && res->ullman >= UINF)
fatal("sgen UINF");
- }
if(w < 0)
fatal("sgen copy %d", w);
+ if(w == 0) {
+ // evaluate side effects only.
+ tempname(&tdst, types[tptr]);
+ agen(res, &tdst);
+ agen(n, &tdst);
+ return;
+ }
+
// offset on the stack
osrc = stkof(n);
odst = stkof(res);
--- /dev/null
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// zero length structs.
+// used to not be evaluated.
+// issue 2232.
+
+package main
+
+func recv(c chan interface{}) struct{} {
+ return (<-c).(struct{})
+}
+
+var m = make(map[interface{}]int)
+
+func recv1(c chan interface{}) {
+ defer rec()
+ m[(<-c).(struct{})] = 0
+}
+
+func rec() {
+ recover()
+}
+
+func main() {
+ c := make(chan interface{})
+ go recv(c)
+ c <- struct{}{}
+ go recv1(c)
+ c <- struct{}{}
+}