From: Ian Lance Taylor <iant@golang.org>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
"gofrontend-dev@googlegroups.com"
<gofrontend-dev@googlegroups.com>
Subject: gccgo patch committed: Permit conversion from any uintptr type to unsafe.Pointer
Date: Mon, 30 Mar 2015 17:32:00 -0000 [thread overview]
Message-ID: <CAOyqgcX0EJgjgRpJJfsu5cFCOWjewUnYg9t9Q0nhvARu91GkOw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 463 bytes --]
The Go language permits converting any type whose underlying type is
uintptr to unsafe.Pointer. The Go frontend did not implement this
correctly. This is http://golang.org/issue/10284. This patch from
Minux fixes the problem. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline.
A test case is being added to the main Go repository
(http://golang.org/cl/8240) and will be copied into the gccgo
testsuite in due course.
Ian
[-- Attachment #2: foo.txt --]
[-- Type: text/plain, Size: 935 bytes --]
diff -r d902a931d05b go/types.cc
--- a/go/types.cc Mon Mar 30 10:26:47 2015 -0700
+++ b/go/types.cc Mon Mar 30 10:30:14 2015 -0700
@@ -772,16 +772,16 @@
}
// An unsafe.Pointer type may be converted to any pointer type or to
- // uintptr, and vice-versa.
+ // a type whose underlying type is uintptr, and vice-versa.
if (lhs->is_unsafe_pointer_type()
&& (rhs->points_to() != NULL
|| (rhs->integer_type() != NULL
- && rhs->forwarded() == Type::lookup_integer_type("uintptr"))))
+ && rhs->integer_type() == Type::lookup_integer_type("uintptr")->real_type())))
return true;
if (rhs->is_unsafe_pointer_type()
&& (lhs->points_to() != NULL
|| (lhs->integer_type() != NULL
- && lhs->forwarded() == Type::lookup_integer_type("uintptr"))))
+ && lhs->integer_type() == Type::lookup_integer_type("uintptr")->real_type())))
return true;
// Give a better error message.
reply other threads:[~2015-03-30 17:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOyqgcX0EJgjgRpJJfsu5cFCOWjewUnYg9t9Q0nhvARu91GkOw@mail.gmail.com \
--to=iant@golang.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gofrontend-dev@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).