return;
// convert static array to dynamic array
- if(isslice(t) && isfixedarray(l->type)) {
- if(eqtype(t->type->type, l->type->type->type, 0)) {
+ if(isslice(t) && isptr[l->type->etype] && isfixedarray(l->type->type)) {
+ if(eqtype(t->type->type, l->type->type->type->type, 0)) {
indir(n, arrayop(n, Erv));
return;
}
case OCONV:
// arrays2d(old *any, nel int) (ary []any)
- t = fixarray(n->left->type);
+ if(n->left->type == T || !isptr[n->left->type->etype])
+ break;
+ t = fixarray(n->left->type->type);
tl = fixarray(n->type);
if(t == T || tl == T)
break;
a->type = types[TINT];
r = a;
- a = nod(OADDR, n->left, N); // old
- addrescapes(n->left);
- r = list(a, r);
+ r = list(n->left, r); // old
on = syslook("arrays2d", 1);
argtype(on, t); // any-1
argtype(on, tl->type); // any-2
r = nod(OCALL, on, r);
- walktype(r, top);
n->left = r;
+ walktype(n, top);
return n;
case OAS:
- // arrays2d(old *any, nel int) (ary []any)
- t = fixarray(n->right->type->type);
- tl = fixarray(n->left->type);
- if(t == T || tl == T)
- break;
-
- a = nodintconst(t->bound); // nel
- a = nod(OCONV, a, N);
- a->type = types[TINT];
- r = a;
-
- r = list(n->right, r); // old
-
- on = syslook("arrays2d", 1);
- argtype(on, t); // any-1
- argtype(on, tl->type); // any-2
- r = nod(OCALL, on, r);
-
- walktype(r, top);
- n->right = r;
+ r = nod(OCONV, n->right, N);
+ r->type = n->left->type;
+ n->right = arrayop(r, Erv);
return n;
case OMAKE:
switch sa1.Family {
case syscall.AF_INET:
sa := (*syscall.SockaddrInet4)(unsafe.Pointer(sa1));
- a := IP(sa.Addr).To16();
+ a := IP(&sa.Addr).To16();
if a == nil {
return nil, 0, os.EINVAL
}
return a, int(sa.Port[0])<<8 + int(sa.Port[1]), nil;
case syscall.AF_INET6:
sa := (*syscall.SockaddrInet6)(unsafe.Pointer(sa1));
- a := IP(sa.Addr).To16();
+ a := IP(&sa.Addr).To16();
if a == nil {
return nil, 0, os.EINVAL
}
switch sa1.Family {
case syscall.AF_INET:
sa := (*syscall.SockaddrInet4)(unsafe.Pointer(sa1));
- a := IP(sa.Addr).To16();
+ a := IP(&sa.Addr).To16();
if a == nil {
return nil, 0, os.EINVAL
}
return a, int(sa.Port[0])<<8 + int(sa.Port[1]), nil;
case syscall.AF_INET6:
sa := (*syscall.SockaddrInet6)(unsafe.Pointer(sa1));
- a := IP(sa.Addr).To16();
+ a := IP(&sa.Addr).To16();
if a == nil {
return nil, 0, os.EINVAL
}
func TestSortIntArray(t *testing.T) {
data := ints;
- a := IntArray(data);
+ a := IntArray(&data);
sort.Sort(a);
if !sort.IsSorted(a) {
t.Errorf("sorted %v", ints);
func TestSortFloatArray(t *testing.T) {
data := floats;
- a := FloatArray(data);
+ a := FloatArray(&data);
sort.Sort(a);
if !sort.IsSorted(a) {
t.Errorf("sorted %v", floats);
func TestSortStringArray(t *testing.T) {
data := strings;
- a := StringArray(data);
+ a := StringArray(&data);
sort.Sort(a);
if !sort.IsSorted(a) {
t.Errorf("sorted %v", strings);
bugs/bug140.go:7: syntax error near L2
BUG should compile
-=========== bugs/bug146.go
-BUG: errchk: bugs/bug146.go:9: missing expected error: 'invalid'
-errchk: bugs/bug146.go: unmatched error messages:
-==================================================
-bugs/bug146.go:8: invalid conversion: *[1]uint8 to Slice
-==================================================
-
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: constant -3 overflows uint