1
0
mirror of https://github.com/golang/go synced 2024-11-24 09:30:07 -07:00

gc: bug325 / issue 1566

Fixes #1566.

R=ken2
CC=golang-dev
https://golang.org/cl/4259041
This commit is contained in:
Russ Cox 2011-02-28 17:16:44 -05:00
parent a3ef19825c
commit 7da86983a8
3 changed files with 15 additions and 2 deletions

View File

@ -203,7 +203,6 @@ fatal(char *fmt, ...)
flusherrors();
*(int*)0=0;
print("%L: internal compiler error: ", lineno);
va_start(arg, fmt);
vfprint(1, fmt, arg);

View File

@ -318,7 +318,7 @@ reswitch:
n->left = N;
goto ret;
}
if(!isptr[t->etype]) {
if(!isptr[t->etype] || (t->type != T && t->type->etype == TANY) /* unsafe.Pointer */) {
yyerror("invalid indirect of %+N", n->left);
goto error;
}

14
test/fixedbugs/bug325.go Normal file
View File

@ -0,0 +1,14 @@
// errchk $G $D/$F.go
// 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.
package main
import "unsafe"
func main() {
var x unsafe.Pointer
println(*x) // ERROR "invalid indirect.*unsafe.Pointer"
}