aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-11-04 17:49:01 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-11-04 17:49:01 +0000
commit8b06e1880ef8583a2aca30f0f5d414061b7da603 (patch)
tree073dfefb57591378d14ae80840407687199c89c6 /gcc
parent4456c6bff2d0290fd167595152121c009d924043 (diff)
downloadgcc-8b06e1880ef8583a2aca30f0f5d414061b7da603.zip
gcc-8b06e1880ef8583a2aca30f0f5d414061b7da603.tar.gz
gcc-8b06e1880ef8583a2aca30f0f5d414061b7da603.tar.bz2
compiler: Logical operators should yield untyped bool for untyped operands.
Fixes issue 6671 for gccgo. From-SVN: r217094
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/expressions.cc9
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/issue3924.go6
2 files changed, 3 insertions, 12 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 6f2b07c..7124646 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -5314,15 +5314,6 @@ Binary_expression::do_determine_type(const Type_context* context)
subcontext.type = NULL;
}
- if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR)
- {
- // For a logical operation, the context does not determine the
- // types of the operands. The operands must be some boolean
- // type but if the context has a boolean type they do not
- // inherit it. See http://golang.org/issue/3924.
- subcontext.type = NULL;
- }
-
// Set the context for the left hand operand.
if (is_shift_op)
{
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue3924.go b/gcc/testsuite/go.test/test/fixedbugs/issue3924.go
index d4739b2..eb7a665 100644
--- a/gcc/testsuite/go.test/test/fixedbugs/issue3924.go
+++ b/gcc/testsuite/go.test/test/fixedbugs/issue3924.go
@@ -1,4 +1,4 @@
-// errorcheck
+// compile
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -9,5 +9,5 @@ package foo
type mybool bool
var x, y = 1, 2
-var _ mybool = x < y && x < y // ERROR "cannot use"
-var _ mybool = x < y || x < y // ERROR "cannot use"
+var _ mybool = x < y && x < y
+var _ mybool = x < y || x < y