diff options
author | Shenghou Ma <minux.ma@gmail.com> | 2012-07-02 09:33:22 +0800 |
---|---|---|
committer | Shenghou Ma <minux.ma@gmail.com> | 2012-07-02 09:33:22 +0800 |
commit | 5b7ce07212042ab7da384d7444bb0d80271e4fc1 (patch) | |
tree | 06d5271346223419ec28a308fbe716530450074c | |
parent | 5e8c05d0b042ca5ccde2bb5a33f368e829270470 (diff) | |
download | go-5b7ce07212042ab7da384d7444bb0d80271e4fc1.tar.gz |
cmd/gc: add missing case for OCOM in defaultlit()
Fixes issue 3765.
R=golang-dev, r
CC=golang-dev
http://codereview.appspot.com/6349064
-rw-r--r-- | src/cmd/gc/const.c | 3 | ||||
-rw-r--r-- | test/fixedbugs/bug445.go | 14 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/cmd/gc/const.c b/src/cmd/gc/const.c index e27c88338..2f323c77f 100644 --- a/src/cmd/gc/const.c +++ b/src/cmd/gc/const.c @@ -1012,12 +1012,13 @@ defaultlit(Node **np, Type *t) } n->type = t; return; + case OCOM: case ONOT: defaultlit(&n->left, t); n->type = n->left->type; return; default: - if(n->left == N) { + if(n->left == N || n->right == N) { dump("defaultlit", n); fatal("defaultlit"); } diff --git a/test/fixedbugs/bug445.go b/test/fixedbugs/bug445.go new file mode 100644 index 000000000..497ecd3ab --- /dev/null +++ b/test/fixedbugs/bug445.go @@ -0,0 +1,14 @@ +// compile + +// Copyright 2012 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. + +// Issue 3765 + +package main + +func f(x uint) uint { + m := ^(1 << x) + return uint(m) +} |