public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Better error message for invalid shifts
@ 2012-12-14 15:02 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2012-12-14 15:02 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

My understanding of shifts of constants in Go has improved.  This patch
more accurately reflects the language spec when it comes to reporting
errors for invalid shifts.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 889 bytes --]

diff -r 9be532343312 go/expressions.cc
--- a/go/expressions.cc	Thu Dec 13 14:14:53 2012 -0800
+++ b/go/expressions.cc	Fri Dec 14 06:45:18 2012 -0800
@@ -5463,13 +5463,10 @@
       // Give a useful error if that happened.
       if (tleft->is_abstract()
 	  && subcontext.type != NULL
-	  && (this->left_->type()->integer_type() == NULL
-	      || (subcontext.type->integer_type() == NULL
-		  && subcontext.type->float_type() == NULL
-		  && subcontext.type->complex_type() == NULL
-		  && subcontext.type->interface_type() == NULL)))
+	  && !subcontext.may_be_abstract
+	  && subcontext.type->integer_type() == NULL)
 	this->report_error(("invalid context-determined non-integer type "
-			    "for shift operand"));
+			    "for left operand of shift"));
 
       // The context for the right hand operand is the same as for the
       // left hand operand, except for a shift operator.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-14 15:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-14 15:02 Go patch committed: Better error message for invalid shifts Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).