* Go patch committed: Fix shift type determination
@ 2017-08-09 21:41 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2017-08-09 21:41 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 529 bytes --]
In Go it's possible to construct an lshift expression using
unsafe.Sizeof that is technically a compile-time constant but can't be
evaluated without going through backend methods. This patch by Than
McIntosh ensures that in this case Type::make_non_abstract_type is
called on the numeric operand of the shift (as opposed to leaving as
abstract), to avoid an assert later on in the compiler flow. This
fixes https://golang.org/issue/21372. Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 871 bytes --]
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE (revision 250992)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-5fd112e5c2968e94761c41519c451d789e23a92b
+480fdfa9dd416bd17115a94fa6021c4dd805fc39
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Index: gcc/go/gofrontend/expressions.cc
===================================================================
--- gcc/go/gofrontend/expressions.cc (revision 250873)
+++ gcc/go/gofrontend/expressions.cc (working copy)
@@ -5655,7 +5655,7 @@ Binary_expression::do_determine_type(con
Type_context subcontext(*context);
- if (is_constant_expr)
+ if (is_constant_expr && !is_shift_op)
{
subcontext.type = NULL;
subcontext.may_be_abstract = true;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-09 21:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-09 21:41 Go patch committed: Fix shift type determination 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).