compiler: don't set ptrmask bit for pointer to notinheap type
Test case is https://go.dev/cl/385454.
Change-Id: I9f84476b1884d66aae2c673297f47a877f60ef58
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/385474
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/types.cc b/go/types.cc
index ee34676..8267f15 100644
--- a/go/types.cc
+++ b/go/types.cc
@@ -2816,6 +2816,9 @@
void
Ptrmask::set_from(Gogo* gogo, Type* type, int64_t ptrsize, int64_t offset)
{
+ if (!type->has_pointer())
+ return;
+
switch (type->base()->classification())
{
default:
@@ -2858,9 +2861,6 @@
case Type::TYPE_STRUCT:
{
- if (!type->has_pointer())
- return;
-
const Struct_field_list* fields = type->struct_type()->fields();
int64_t soffset = 0;
for (Struct_field_list::const_iterator pf = fields->begin();
@@ -2898,9 +2898,6 @@
}
else
{
- if (!type->has_pointer())
- return;
-
int64_t len;
if (!type->array_type()->int_length(&len))
{