]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1] cmd/gc: add missing case for OCOM in defaultlit()
authorShenghou Ma <minux.ma@gmail.com>
Fri, 21 Sep 2012 19:53:56 +0000 (05:53 +1000)
committerShenghou Ma <minux.ma@gmail.com>
Fri, 21 Sep 2012 19:53:56 +0000 (05:53 +1000)
««« backport b5c4f411a852
cmd/gc: add missing case for OCOM in defaultlit()
        Fixes #3765.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6349064

»»»

src/cmd/gc/const.c
test/fixedbugs/bug445.go [new file with mode: 0644]

index e27c88338741b8d6e4da3493cfdda31c0b414fb5..2f323c77f97c94ef52edaf0ad738f4470422f6e7 100644 (file)
@@ -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 (file)
index 0000000..497ecd3
--- /dev/null
@@ -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)
+}