* Go patch committed: Fix type comparison
@ 2011-06-08 19:32 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2011-06-08 19:32 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 221 bytes --]
This patch to the Go frontend fixes a dumb mistake I made: I compared
the TYPE_SIZE pointers rather than the actual type size. 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: 779 bytes --]
diff -r 292aa99c6436 go/expressions.cc
--- a/go/expressions.cc Tue May 31 11:14:19 2011 -0700
+++ b/go/expressions.cc Wed Jun 08 11:52:32 2011 -0700
@@ -754,8 +754,13 @@
ret = NULL_TREE;
}
- if ((TYPE_UNSIGNED(val_type) && !TYPE_UNSIGNED(bound_type))
- || TYPE_SIZE(val_type) > TYPE_SIZE(bound_type))
+ HOST_WIDE_INT val_type_size = int_size_in_bytes(val_type);
+ HOST_WIDE_INT bound_type_size = int_size_in_bytes(bound_type);
+ go_assert(val_type_size != -1 && bound_type_size != -1);
+ if (val_type_size > bound_type_size
+ || (val_type_size == bound_type_size
+ && TYPE_UNSIGNED(val_type)
+ && !TYPE_UNSIGNED(bound_type)))
{
tree max = TYPE_MAX_VALUE(bound_type);
tree big = fold_build2_loc(loc, GT_EXPR, boolean_type_node, val,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-08 18:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 19:32 Go patch committed: Fix type comparison 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).