aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-09-14 03:45:44 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-09-14 03:45:44 +0000
commited52163bea1916404119f397e6f99a4b90477f37 (patch)
tree9e211125ff0ef3b98eea862b4f6ee608402e7012 /gcc/go
parent09abdb23cd62999602f2dba8783017ebbb096c1f (diff)
downloadgcc-ed52163bea1916404119f397e6f99a4b90477f37.zip
gcc-ed52163bea1916404119f397e6f99a4b90477f37.tar.gz
gcc-ed52163bea1916404119f397e6f99a4b90477f37.tar.bz2
compiler: fix check for notinheap conversion
A normal pointer may not be converted to a notinheap pointer. We were erroneously permitting a conversion from a normal pointer to a notinheap unsafe.Pointer, which is useless since unsafe.Pointer is not marked notinheap. Correct the test to permit a conversion from unsafe.Pointer to a notinheap pointer, which is the same test that the gc compiler uses. The test case for this is in the 1.9 runtime package. Reviewed-on: https://go-review.googlesource.com/62731 From-SVN: r252745
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/types.cc10
2 files changed, 6 insertions, 6 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 9576230..c4600de 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-52ebad939927e6cbfb48dd277cef8db451e36533
+8c6d9ff6f60b737d1e96c0dab0b4e67402bf3316
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index cde1408..cdf1f40 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -747,16 +747,16 @@ Type::are_convertible(const Type* lhs, const Type* rhs, std::string* reason)
return true;
// A pointer to a regular type may not be converted to a pointer to
- // a type that may not live in the heap, except when converting to
+ // a type that may not live in the heap, except when converting from
// unsafe.Pointer.
if (lhs->points_to() != NULL
&& rhs->points_to() != NULL
- && !rhs->points_to()->in_heap()
- && lhs->points_to()->in_heap()
- && !lhs->is_unsafe_pointer_type())
+ && !lhs->points_to()->in_heap()
+ && rhs->points_to()->in_heap()
+ && !rhs->is_unsafe_pointer_type())
{
if (reason != NULL)
- reason->assign(_("conversion from notinheap type to normal type"));
+ reason->assign(_("conversion from normal type to notinheap type"));
return false;
}