This is the mail archive of the
mailing list for the GCC project.
Go patch committed: Fix bug in type of shortcut operation
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Wed, 18 Sep 2013 11:36:34 -0700
- Subject: Go patch committed: Fix bug in type of shortcut operation
- Authentication-results: sourceware.org; auth=none
When the Go frontend converts a shortcut operator like && or || to an if
statement, it used the wrong type for the temporary variable. It always
used bool, but the operator could be using a named version of bool.
This matters when the type has methods. This patch fixes the problem.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.8 branch.
diff -r 35afa97b6c21 go/gogo.cc
--- a/go/gogo.cc Tue Sep 17 15:09:45 2013 -0700
+++ b/go/gogo.cc Wed Sep 18 11:30:33 2013 -0700
@@ -2367,7 +2367,7 @@
Block* retblock = new Block(enclosing, loc);
- Temporary_statement* ts = Statement::make_temporary(Type::lookup_bool_type(),
+ Temporary_statement* ts = Statement::make_temporary(shortcut->type(),