From e109f6e438b72ef3e403162971068d28d09b82f5 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 10 Jul 2020 13:43:09 -0700 Subject: compiler: avoid generating unnamed bool type descriptor We were generating it in cases where a boolean expression was converted directly to an empty interface type. Fixes golang/go#40152 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/242002 --- gcc/go/gofrontend/names.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/go/gofrontend/names.cc') diff --git a/gcc/go/gofrontend/names.cc b/gcc/go/gofrontend/names.cc index a721a36..1f0a545 100644 --- a/gcc/go/gofrontend/names.cc +++ b/gcc/go/gofrontend/names.cc @@ -975,7 +975,14 @@ Gogo::type_descriptor_name(const Type* type, Named_type* nt) return "unsafe.Pointer..d"; if (nt == NULL) - return "type.." + type->mangled_name(this); + { + // Sanity check: we should never generate a type descriptor for + // an unnamed primitive type. For those we should always be + // using a named type, like "int". + go_assert(!type->is_basic_type()); + + return "type.." + type->mangled_name(this); + } std::string ret; Named_object* no = nt->named_object(); -- cgit v1.1