Define go_assert to replace gcc_assert
[gcc.git] / gcc / go / gofrontend / expressions.cc
index 8a1fc349b95759bde7faaefeb3345c6c3d0f0ef3..ee065bfefab11311bddca006fbadd7fb2e356018 100644 (file)
@@ -236,27 +236,27 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
           && rhs_type->is_nil_type())
     {
       // Assigning nil to an open array.
-      gcc_assert(TREE_CODE(lhs_type_tree) == RECORD_TYPE);
+      go_assert(TREE_CODE(lhs_type_tree) == RECORD_TYPE);
 
       VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
 
       constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
       tree field = TYPE_FIELDS(lhs_type_tree);
-      gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
+      go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
                        "__values") == 0);
       elt->index = field;
       elt->value = fold_convert(TREE_TYPE(field), null_pointer_node);
 
       elt = VEC_quick_push(constructor_elt, init, NULL);
       field = DECL_CHAIN(field);
-      gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
+      go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
                        "__count") == 0);
       elt->index = field;
       elt->value = fold_convert(TREE_TYPE(field), integer_zero_node);
 
       elt = VEC_quick_push(constructor_elt, init, NULL);
       field = DECL_CHAIN(field);
-      gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
+      go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
                        "__capacity") == 0);
       elt->index = field;
       elt->value = fold_convert(TREE_TYPE(field), integer_zero_node);
@@ -270,7 +270,7 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
     {
       // The left hand side should be a pointer type at the tree
       // level.
-      gcc_assert(POINTER_TYPE_P(lhs_type_tree));
+      go_assert(POINTER_TYPE_P(lhs_type_tree));
       return fold_convert(lhs_type_tree, null_pointer_node);
     }
   else if (lhs_type_tree == TREE_TYPE(rhs_tree))
@@ -288,14 +288,14 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type,
     {
       // This conversion must be permitted by Go, or we wouldn't have
       // gotten here.
-      gcc_assert(int_size_in_bytes(lhs_type_tree)
+      go_assert(int_size_in_bytes(lhs_type_tree)
                 == int_size_in_bytes(TREE_TYPE(rhs_tree)));
       return fold_build1_loc(location, VIEW_CONVERT_EXPR, lhs_type_tree,
                             rhs_tree);
     }
   else
     {
-      gcc_assert(useless_type_conversion_p(lhs_type_tree, TREE_TYPE(rhs_tree)));
+      go_assert(useless_type_conversion_p(lhs_type_tree, TREE_TYPE(rhs_tree)));
       return rhs_tree;
     }
 }
@@ -321,7 +321,7 @@ Expression::convert_type_to_interface(Translate_context* context,
     return lhs_type->get_init_tree(gogo, false);
 
   // This should have been checked already.
-  gcc_assert(lhs_interface_type->implements_interface(rhs_type, NULL));
+  go_assert(lhs_interface_type->implements_interface(rhs_type, NULL));
 
   tree lhs_type_tree = lhs_type->get_tree(gogo);
   if (lhs_type_tree == error_mark_node)
@@ -364,14 +364,14 @@ Expression::convert_type_to_interface(Translate_context* context,
 
   constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
   tree field = TYPE_FIELDS(lhs_type_tree);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
                    (lhs_is_empty ? "__type_descriptor" : "__methods")) == 0);
   elt->index = field;
   elt->value = fold_convert_loc(location, TREE_TYPE(field), first_field_value);
 
   elt = VEC_quick_push(constructor_elt, init, NULL);
   field = DECL_CHAIN(field);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
   elt->index = field;
 
   if (rhs_type->points_to() != NULL)
@@ -413,25 +413,25 @@ Expression::get_interface_type_descriptor(Translate_context*,
                                          source_location location)
 {
   tree rhs_type_tree = TREE_TYPE(rhs_tree);
-  gcc_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
+  go_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
   tree rhs_field = TYPE_FIELDS(rhs_type_tree);
   tree v = build3(COMPONENT_REF, TREE_TYPE(rhs_field), rhs_tree, rhs_field,
                  NULL_TREE);
   if (rhs_type->interface_type()->is_empty())
     {
-      gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)),
+      go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)),
                        "__type_descriptor") == 0);
       return v;
     }
 
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)), "__methods")
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)), "__methods")
             == 0);
-  gcc_assert(POINTER_TYPE_P(TREE_TYPE(v)));
+  go_assert(POINTER_TYPE_P(TREE_TYPE(v)));
   v = save_expr(v);
   tree v1 = build_fold_indirect_ref_loc(location, v);
-  gcc_assert(TREE_CODE(TREE_TYPE(v1)) == RECORD_TYPE);
+  go_assert(TREE_CODE(TREE_TYPE(v1)) == RECORD_TYPE);
   tree f = TYPE_FIELDS(TREE_TYPE(v1));
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(f)), "__type_descriptor")
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(f)), "__type_descriptor")
             == 0);
   v1 = build3(COMPONENT_REF, TREE_TYPE(f), v1, f, NULL_TREE);
 
@@ -510,16 +510,16 @@ Expression::convert_interface_to_interface(Translate_context* context,
     {
       // A convertion to an empty interface always succeeds, and the
       // first field is just the type descriptor of the object.
-      gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
+      go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),
                        "__type_descriptor") == 0);
-      gcc_assert(TREE_TYPE(field) == TREE_TYPE(rhs_type_descriptor));
+      go_assert(TREE_TYPE(field) == TREE_TYPE(rhs_type_descriptor));
       elt->value = rhs_type_descriptor;
     }
   else
     {
       // A conversion to a non-empty interface may fail, but unlike a
       // type assertion converting nil will always succeed.
-      gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__methods")
+      go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__methods")
                 == 0);
       tree lhs_type_descriptor = lhs_type->type_descriptor_pointer(gogo);
       static tree convert_interface_decl;
@@ -543,13 +543,13 @@ Expression::convert_interface_to_interface(Translate_context* context,
 
   elt = VEC_quick_push(constructor_elt, init, NULL);
   field = DECL_CHAIN(field);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
   elt->index = field;
 
   tree rhs_type_tree = TREE_TYPE(rhs_tree);
-  gcc_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
+  go_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
   tree rhs_field = DECL_CHAIN(TYPE_FIELDS(rhs_type_tree));
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)), "__object") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)), "__object") == 0);
   elt->value = build3(COMPONENT_REF, TREE_TYPE(rhs_field), rhs_tree, rhs_field,
                      NULL_TREE);
 
@@ -604,9 +604,9 @@ Expression::convert_interface_to_type(Translate_context* context,
   TREE_NOTHROW(check_interface_type_decl) = 0;
 
   // If the call succeeds, pull out the value.
-  gcc_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
+  go_assert(TREE_CODE(rhs_type_tree) == RECORD_TYPE);
   tree rhs_field = DECL_CHAIN(TYPE_FIELDS(rhs_type_tree));
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)), "__object") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(rhs_field)), "__object") == 0);
   tree val = build3(COMPONENT_REF, TREE_TYPE(rhs_field), rhs_tree, rhs_field,
                    NULL_TREE);
 
@@ -902,7 +902,7 @@ Parser_expression::do_type()
   // However, it can happen, at least when we have an invalid const
   // whose initializer refers to the const itself.  In that case we
   // may ask for the type when lowering the const itself.
-  gcc_assert(saw_errors());
+  go_assert(saw_errors());
   return Type::make_error_type();
 }
 
@@ -1118,7 +1118,7 @@ Sink_expression::do_get_tree(Translate_context* context)
 {
   if (this->var_ == NULL_TREE)
     {
-      gcc_assert(this->type_ != NULL && !this->type_->is_sink_type());
+      go_assert(this->type_ != NULL && !this->type_->is_sink_type());
       this->var_ = create_tmp_var(this->type_->get_tree(context->gogo()),
                                  "blank");
     }
@@ -1219,7 +1219,7 @@ Func_expression::do_get_tree(Translate_context* context)
   if (fnaddr == error_mark_node)
     return error_mark_node;
 
-  gcc_assert(TREE_CODE(fnaddr) == ADDR_EXPR
+  go_assert(TREE_CODE(fnaddr) == ADDR_EXPR
             && TREE_CODE(TREE_OPERAND(fnaddr, 0)) == FUNCTION_DECL);
   TREE_ADDRESSABLE(TREE_OPERAND(fnaddr, 0)) = 1;
 
@@ -1227,7 +1227,7 @@ Func_expression::do_get_tree(Translate_context* context)
   if (!this->function_->is_function()
       || this->function_->func_value()->enclosing() == NULL)
     {
-      gcc_assert(this->closure_ == NULL);
+      go_assert(this->closure_ == NULL);
       return fnaddr;
     }
 
@@ -1245,7 +1245,7 @@ Func_expression::do_get_tree(Translate_context* context)
       closure_tree = closure->get_tree(context);
       if (closure_tree == error_mark_node)
        return error_mark_node;
-      gcc_assert(POINTER_TYPE_P(TREE_TYPE(closure_tree)));
+      go_assert(POINTER_TYPE_P(TREE_TYPE(closure_tree)));
     }
 
   // Now we need to build some code on the heap.  This code will load
@@ -1330,7 +1330,7 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int)
 Expression*
 Expression::make_unknown_reference(Named_object* no, source_location location)
 {
-  gcc_assert(no->resolve()->is_unknown());
+  go_assert(no->resolve()->is_unknown());
   return new Unknown_expression(no, location);
 }
 
@@ -2009,7 +2009,7 @@ Float_expression::do_check_types(Gogo*)
        this->report_error(_("floating point constant truncated to integer"));
       else
        {
-         gcc_assert(!integer_type->is_abstract());
+         go_assert(!integer_type->is_abstract());
          mpz_t ival;
          mpz_init(ival);
          mpfr_get_z(ival, this->val_, GMP_RNDN);
@@ -3422,7 +3422,7 @@ Type_conversion_expression::do_get_tree(Translate_context* context)
        expr_tree = save_expr(expr_tree);
       Array_type* a = t->array_type();
       Type* e = a->element_type()->forwarded();
-      gcc_assert(e->integer_type() != NULL);
+      go_assert(e->integer_type() != NULL);
       tree valptr = fold_convert(const_ptr_type_node,
                                 a->value_pointer_tree(gogo, expr_tree));
       tree len = a->length_tree(gogo, expr_tree);
@@ -3443,7 +3443,7 @@ Type_conversion_expression::do_get_tree(Translate_context* context)
        }
       else
        {
-         gcc_assert(e == Type::lookup_integer_type("int"));
+         go_assert(e == Type::lookup_integer_type("int"));
          static tree int_array_to_string_fndecl;
          ret = Gogo::call_builtin(&int_array_to_string_fndecl,
                                   this->location(),
@@ -3459,7 +3459,7 @@ Type_conversion_expression::do_get_tree(Translate_context* context)
   else if (type->is_open_array_type() && expr_type->is_string_type())
     {
       Type* e = type->array_type()->element_type()->forwarded();
-      gcc_assert(e->integer_type() != NULL);
+      go_assert(e->integer_type() != NULL);
       if (e->integer_type()->is_unsigned()
          && e->integer_type()->bits() == 8)
        {
@@ -3474,7 +3474,7 @@ Type_conversion_expression::do_get_tree(Translate_context* context)
        }
       else
        {
-         gcc_assert(e == Type::lookup_integer_type("int"));
+         go_assert(e == Type::lookup_integer_type("int"));
          static tree string_to_int_array_fndecl;
          ret = Gogo::call_builtin(&string_to_int_array_fndecl,
                                   this->location(),
@@ -3611,36 +3611,36 @@ Unsafe_type_conversion_expression::do_get_tree(Translate_context* context)
   bool use_view_convert = false;
   if (t->is_open_array_type())
     {
-      gcc_assert(et->is_open_array_type());
+      go_assert(et->is_open_array_type());
       use_view_convert = true;
     }
   else if (t->map_type() != NULL)
-    gcc_assert(et->map_type() != NULL);
+    go_assert(et->map_type() != NULL);
   else if (t->channel_type() != NULL)
-    gcc_assert(et->channel_type() != NULL);
+    go_assert(et->channel_type() != NULL);
   else if (t->points_to() != NULL && t->points_to()->channel_type() != NULL)
-    gcc_assert((et->points_to() != NULL
+    go_assert((et->points_to() != NULL
                && et->points_to()->channel_type() != NULL)
               || et->is_nil_type());
   else if (t->is_unsafe_pointer_type())
-    gcc_assert(et->points_to() != NULL || et->is_nil_type());
+    go_assert(et->points_to() != NULL || et->is_nil_type());
   else if (et->is_unsafe_pointer_type())
-    gcc_assert(t->points_to() != NULL);
+    go_assert(t->points_to() != NULL);
   else if (t->interface_type() != NULL && !t->interface_type()->is_empty())
     {
-      gcc_assert(et->interface_type() != NULL
+      go_assert(et->interface_type() != NULL
                 && !et->interface_type()->is_empty());
       use_view_convert = true;
     }
   else if (t->interface_type() != NULL && t->interface_type()->is_empty())
     {
-      gcc_assert(et->interface_type() != NULL
+      go_assert(et->interface_type() != NULL
                 && et->interface_type()->is_empty());
       use_view_convert = true;
     }
   else if (t->integer_type() != NULL)
     {
-      gcc_assert(et->is_boolean_type()
+      go_assert(et->is_boolean_type()
                 || et->integer_type() != NULL
                 || et->function_type() != NULL
                 || et->points_to() != NULL
@@ -3690,7 +3690,7 @@ class Unary_expression : public Expression
   void
   set_does_not_escape()
   {
-    gcc_assert(this->op_ == OPERATOR_AND);
+    go_assert(this->op_ == OPERATOR_AND);
     this->escapes_ = false;
   }
 
@@ -3950,7 +3950,7 @@ Unary_expression::eval_integer(Operator op, Type* utype, mpz_t uval, mpz_t val,
 
          size_t ecount;
          mpz_export(phwi, &ecount, -1, sizeof(HOST_WIDE_INT), 0, 0, uval);
-         gcc_assert(ecount <= count);
+         go_assert(ecount <= count);
 
          // Trim down to the number of words required by the type.
          size_t obits = utype->integer_type()->bits();
@@ -3958,7 +3958,7 @@ Unary_expression::eval_integer(Operator op, Type* utype, mpz_t uval, mpz_t val,
            ++obits;
          size_t ocount = ((obits + HOST_BITS_PER_WIDE_INT - 1)
                           / HOST_BITS_PER_WIDE_INT);
-         gcc_assert(ocount <= count);
+         go_assert(ocount <= count);
 
          for (size_t i = 0; i < ocount; ++i)
            phwi[i] = ~phwi[i];
@@ -4252,8 +4252,8 @@ Unary_expression::do_get_tree(Translate_context* context)
       // where we would see one should have been moved onto the heap
       // at parse time.  Taking the address of a nonconstant
       // constructor will not do what the programmer expects.
-      gcc_assert(TREE_CODE(expr) != CONSTRUCTOR || TREE_CONSTANT(expr));
-      gcc_assert(TREE_CODE(expr) != ADDR_EXPR);
+      go_assert(TREE_CODE(expr) != CONSTRUCTOR || TREE_CONSTANT(expr));
+      go_assert(TREE_CODE(expr) != ADDR_EXPR);
 
       // Build a decl for a constant constructor.
       if (TREE_CODE(expr) == CONSTRUCTOR && TREE_CONSTANT(expr))
@@ -4276,7 +4276,7 @@ Unary_expression::do_get_tree(Translate_context* context)
 
     case OPERATOR_MULT:
       {
-       gcc_assert(POINTER_TYPE_P(TREE_TYPE(expr)));
+       go_assert(POINTER_TYPE_P(TREE_TYPE(expr)));
 
        // If we are dereferencing the pointer to a large struct, we
        // need to check for nil.  We don't bother to check for small
@@ -5156,7 +5156,7 @@ Binary_expression::do_lower(Gogo*, Named_object*, int)
                                                right_type, right_val,
                                                location, val))
              {
-               gcc_assert(op != OPERATOR_OROR && op != OPERATOR_ANDAND);
+               go_assert(op != OPERATOR_OROR && op != OPERATOR_ANDAND);
                Type* type;
                if (op == OPERATOR_LSHIFT || op == OPERATOR_RSHIFT)
                  type = left_type;
@@ -5240,7 +5240,7 @@ Binary_expression::do_lower(Gogo*, Named_object*, int)
                                              right_type, right_val, val,
                                              location))
              {
-               gcc_assert(op != OPERATOR_OROR && op != OPERATOR_ANDAND
+               go_assert(op != OPERATOR_OROR && op != OPERATOR_ANDAND
                           && op != OPERATOR_LSHIFT && op != OPERATOR_RSHIFT);
                Type* type;
                if (left_type == NULL)
@@ -5331,7 +5331,7 @@ Binary_expression::do_lower(Gogo*, Named_object*, int)
                                                real, imag,
                                                location))
              {
-               gcc_assert(op != OPERATOR_OROR && op != OPERATOR_ANDAND
+               go_assert(op != OPERATOR_OROR && op != OPERATOR_ANDAND
                           && op != OPERATOR_LSHIFT && op != OPERATOR_RSHIFT);
                Type* type;
                if (left_type == NULL)
@@ -5983,7 +5983,7 @@ Binary_expression::do_get_tree(Translate_context* context)
 
   if (this->left_->type()->is_string_type())
     {
-      gcc_assert(this->op_ == OPERATOR_PLUS);
+      go_assert(this->op_ == OPERATOR_PLUS);
       tree string_type = Type::make_string_type()->get_tree(context->gogo());
       static tree string_plus_decl;
       return Gogo::call_builtin(&string_plus_decl,
@@ -6036,8 +6036,8 @@ Binary_expression::do_get_tree(Translate_context* context)
   // This is not true in GENERIC, so we need to insert a conditional.
   if (is_shift_op)
     {
-      gcc_assert(INTEGRAL_TYPE_P(TREE_TYPE(left)));
-      gcc_assert(this->left_->type()->integer_type() != NULL);
+      go_assert(INTEGRAL_TYPE_P(TREE_TYPE(left)));
+      go_assert(this->left_->type()->integer_type() != NULL);
       int bits = TYPE_PRECISION(TREE_TYPE(left));
 
       tree compare = fold_build2(LT_EXPR, boolean_type_node, right,
@@ -6458,12 +6458,12 @@ Expression::comparison_tree(Translate_context* context, Operator op,
        {
          if (left_type->interface_type()->is_empty())
            {
-             gcc_assert(op == OPERATOR_EQEQ || op == OPERATOR_NOTEQ);
+             go_assert(op == OPERATOR_EQEQ || op == OPERATOR_NOTEQ);
              std::swap(left_type, right_type);
              std::swap(left_tree, right_tree);
            }
-         gcc_assert(!left_type->interface_type()->is_empty());
-         gcc_assert(right_type->interface_type()->is_empty());
+         go_assert(!left_type->interface_type()->is_empty());
+         go_assert(right_type->interface_type()->is_empty());
          static tree interface_empty_compare_decl;
          left_tree = Gogo::call_builtin(&interface_empty_compare_decl,
                                         location,
@@ -6503,7 +6503,7 @@ Expression::comparison_tree(Translate_context* context, Operator op,
        {
          // An interface is nil if the first field is nil.
          tree left_type_tree = TREE_TYPE(left_tree);
-         gcc_assert(TREE_CODE(left_type_tree) == RECORD_TYPE);
+         go_assert(TREE_CODE(left_type_tree) == RECORD_TYPE);
          tree field = TYPE_FIELDS(left_type_tree);
          left_tree = build3(COMPONENT_REF, TREE_TYPE(field), left_tree,
                             field, NULL_TREE);
@@ -6511,7 +6511,7 @@ Expression::comparison_tree(Translate_context* context, Operator op,
        }
       else
        {
-         gcc_assert(POINTER_TYPE_P(TREE_TYPE(left_tree)));
+         go_assert(POINTER_TYPE_P(TREE_TYPE(left_tree)));
          right_tree = fold_convert(TREE_TYPE(left_tree), null_pointer_node);
        }
     }
@@ -6723,7 +6723,7 @@ Builtin_call_expression::Builtin_call_expression(Gogo* gogo,
     gogo_(gogo), code_(BUILTIN_INVALID), seen_(false)
 {
   Func_expression* fnexp = this->fn()->func_expression();
-  gcc_assert(fnexp != NULL);
+  go_assert(fnexp != NULL);
   const std::string& name(fnexp->named_object()->name());
   if (name == "append")
     this->code_ = BUILTIN_APPEND;
@@ -6780,7 +6780,7 @@ void
 Builtin_call_expression::do_set_recover_arg(Expression* arg)
 {
   const Expression_list* args = this->args();
-  gcc_assert(args == NULL || args->empty());
+  go_assert(args == NULL || args->empty());
   Expression_list* new_args = new Expression_list();
   new_args->push_back(arg);
   this->set_args(new_args);
@@ -7158,7 +7158,7 @@ Builtin_call_expression::do_integer_constant_value(bool iota_is_constant,
       if (this->code_ == BUILTIN_SIZEOF)
        {
          tree type_size = TYPE_SIZE_UNIT(arg_type_tree);
-         gcc_assert(TREE_CODE(type_size) == INTEGER_CST);
+         go_assert(TREE_CODE(type_size) == INTEGER_CST);
          if (TREE_INT_CST_HIGH(type_size) != 0)
            return false;
          unsigned HOST_WIDE_INT val_wide = TREE_INT_CST_LOW(type_size);
@@ -7198,12 +7198,12 @@ Builtin_call_expression::do_integer_constant_value(bool iota_is_constant,
       if (st->named_type() != NULL)
        st->named_type()->convert(this->gogo_);
       tree struct_tree = st->get_tree(this->gogo_);
-      gcc_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
+      go_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
       tree field = TYPE_FIELDS(struct_tree);
       for (unsigned int index = farg->field_index(); index > 0; --index)
        {
          field = DECL_CHAIN(field);
-         gcc_assert(field != NULL_TREE);
+         go_assert(field != NULL_TREE);
        }
       HOST_WIDE_INT offset_wide = int_byte_position (field);
       if (offset_wide < 0)
@@ -7747,13 +7747,13 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_CAP:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 1);
+       go_assert(args != NULL && args->size() == 1);
        Expression* arg = *args->begin();
        Type* arg_type = arg->type();
 
        if (this->seen_)
          {
-           gcc_assert(saw_errors());
+           go_assert(saw_errors());
            return error_mark_node;
          }
        this->seen_ = true;
@@ -7768,9 +7768,9 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
        if (arg_type->points_to() != NULL)
          {
            arg_type = arg_type->points_to();
-           gcc_assert(arg_type->array_type() != NULL
+           go_assert(arg_type->array_type() != NULL
                       && !arg_type->is_open_array_type());
-           gcc_assert(POINTER_TYPE_P(TREE_TYPE(arg_tree)));
+           go_assert(POINTER_TYPE_P(TREE_TYPE(arg_tree)));
            arg_tree = build_fold_indirect_ref(arg_tree);
          }
 
@@ -7783,7 +7783,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
              {
                if (this->seen_)
                  {
-                   gcc_assert(saw_errors());
+                   go_assert(saw_errors());
                    return error_mark_node;
                  }
                this->seen_ = true;
@@ -7821,7 +7821,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
              {
                if (this->seen_)
                  {
-                   gcc_assert(saw_errors());
+                   go_assert(saw_errors());
                    return error_mark_node;
                  }
                this->seen_ = true;
@@ -8000,7 +8000,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_PANIC:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 1);
+       go_assert(args != NULL && args->size() == 1);
        Expression* arg = args->front();
        tree arg_tree = arg->get_tree(context);
        if (arg_tree == error_mark_node)
@@ -8031,7 +8031,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
        // The argument is set when building recover thunks.  It's a
        // boolean value which is true if we can recover a value now.
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 1);
+       go_assert(args != NULL && args->size() == 1);
        Expression* arg = args->front();
        tree arg_tree = arg->get_tree(context);
        if (arg_tree == error_mark_node)
@@ -8080,7 +8080,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_CLOSE:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 1);
+       go_assert(args != NULL && args->size() == 1);
        Expression* arg = args->front();
        tree arg_tree = arg->get_tree(context);
        if (arg_tree == error_mark_node)
@@ -8105,7 +8105,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
        bool b = this->integer_constant_value(true, val, &dummy);
        if (!b)
          {
-           gcc_assert(saw_errors());
+           go_assert(saw_errors());
            return error_mark_node;
          }
        tree type = Type::lookup_integer_type("int")->get_tree(gogo);
@@ -8117,7 +8117,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_COPY:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 2);
+       go_assert(args != NULL && args->size() == 2);
        Expression* arg1 = args->front();
        Expression* arg2 = args->back();
 
@@ -8199,7 +8199,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_APPEND:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 2);
+       go_assert(args != NULL && args->size() == 2);
        Expression* arg1 = args->front();
        Expression* arg2 = args->back();
 
@@ -8255,12 +8255,12 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_IMAG:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 1);
+       go_assert(args != NULL && args->size() == 1);
        Expression* arg = args->front();
        tree arg_tree = arg->get_tree(context);
        if (arg_tree == error_mark_node)
          return error_mark_node;
-       gcc_assert(COMPLEX_FLOAT_TYPE_P(TREE_TYPE(arg_tree)));
+       go_assert(COMPLEX_FLOAT_TYPE_P(TREE_TYPE(arg_tree)));
        if (this->code_ == BUILTIN_REAL)
          return fold_build1_loc(location, REALPART_EXPR,
                                 TREE_TYPE(TREE_TYPE(arg_tree)),
@@ -8274,14 +8274,14 @@ Builtin_call_expression::do_get_tree(Translate_context* context)
     case BUILTIN_COMPLEX:
       {
        const Expression_list* args = this->args();
-       gcc_assert(args != NULL && args->size() == 2);
+       go_assert(args != NULL && args->size() == 2);
        tree r = args->front()->get_tree(context);
        tree i = args->back()->get_tree(context);
        if (r == error_mark_node || i == error_mark_node)
          return error_mark_node;
-       gcc_assert(TYPE_MAIN_VARIANT(TREE_TYPE(r))
+       go_assert(TYPE_MAIN_VARIANT(TREE_TYPE(r))
                   == TYPE_MAIN_VARIANT(TREE_TYPE(i)));
-       gcc_assert(SCALAR_FLOAT_TYPE_P(TREE_TYPE(r)));
+       go_assert(SCALAR_FLOAT_TYPE_P(TREE_TYPE(r)));
        return fold_build2_loc(location, COMPLEX_EXPR,
                               build_complex_type(TREE_TYPE(r)),
                               r, i);
@@ -8418,7 +8418,7 @@ Call_expression::do_lower(Gogo* gogo, Named_object* function, int)
     {
       Function_type* fntype = this->fn_->type()->function_type();
       const Typed_identifier_list* parameters = fntype->parameters();
-      gcc_assert(parameters != NULL && !parameters->empty());
+      go_assert(parameters != NULL && !parameters->empty());
       Type* varargs_type = parameters->back().type();
       return this->lower_varargs(gogo, function, varargs_type,
                                 parameters->size());
@@ -8443,8 +8443,8 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function,
 
   source_location loc = this->location();
 
-  gcc_assert(param_count > 0);
-  gcc_assert(varargs_type->is_open_array_type());
+  go_assert(param_count > 0);
+  go_assert(varargs_type->is_open_array_type());
 
   size_t arg_count = this->args_ == NULL ? 0 : this->args_->size();
   if (arg_count < param_count - 1)
@@ -8458,7 +8458,7 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function,
   bool push_empty_arg = false;
   if (old_args == NULL || old_args->empty())
     {
-      gcc_assert(param_count == 1);
+      go_assert(param_count == 1);
       push_empty_arg = true;
     }
   else
@@ -8517,7 +8517,7 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function,
   // Lower all the new subexpressions.
   Expression* ret = this;
   gogo->lower_expression(function, &ret);
-  gcc_assert(ret == this);
+  go_assert(ret == this);
   return ret;
 }
 
@@ -8868,7 +8868,7 @@ Call_expression::do_get_tree(Translate_context* context)
     this->fn_->interface_field_reference_expression();
   const bool has_closure = func != NULL && func->closure() != NULL;
   const bool is_method = bound_method != NULL || interface_method != NULL;
-  gcc_assert(!fntype->is_method() || is_method);
+  go_assert(!fntype->is_method() || is_method);
 
   int nargs;
   tree* args;
@@ -8880,7 +8880,7 @@ Call_expression::do_get_tree(Translate_context* context)
   else
     {
       const Typed_identifier_list* params = fntype->parameters();
-      gcc_assert(params != NULL);
+      go_assert(params != NULL);
 
       nargs = this->args_->size();
       int i = is_method ? 1 : 0;
@@ -8893,7 +8893,7 @@ Call_expression::do_get_tree(Translate_context* context)
           pe != this->args_->end();
           ++pe, ++pp, ++i)
        {
-         gcc_assert(pp != params->end());
+         go_assert(pp != params->end());
          tree arg_val = (*pe)->get_tree(context);
          args[i] = Expression::convert_for_assignment(context,
                                                       pp->type(),
@@ -8906,8 +8906,8 @@ Call_expression::do_get_tree(Translate_context* context)
              return error_mark_node;
            }
        }
-      gcc_assert(pp == params->end());
-      gcc_assert(i == nargs);
+      go_assert(pp == params->end());
+      go_assert(i == nargs);
     }
 
   tree rettype = TREE_TYPE(TREE_TYPE(fntype->get_tree(gogo)));
@@ -9155,16 +9155,16 @@ Call_result_expression::do_get_tree(Translate_context* context)
     return error_mark_node;
   if (TREE_CODE(TREE_TYPE(call_tree)) != RECORD_TYPE)
     {
-      gcc_assert(saw_errors());
+      go_assert(saw_errors());
       return error_mark_node;
     }
   tree field = TYPE_FIELDS(TREE_TYPE(call_tree));
   for (unsigned int i = 0; i < this->index_; ++i)
     {
-      gcc_assert(field != NULL_TREE);
+      go_assert(field != NULL_TREE);
       field = DECL_CHAIN(field);
     }
-  gcc_assert(field != NULL_TREE);
+  go_assert(field != NULL_TREE);
   return build3(COMPONENT_REF, TREE_TYPE(field), call_tree, field, NULL_TREE);
 }
 
@@ -9380,7 +9380,7 @@ Array_index_expression::do_check_types(Gogo*)
   Array_type* array_type = this->array_->type()->array_type();
   if (array_type == NULL)
     {
-      gcc_assert(this->array_->type()->is_error());
+      go_assert(this->array_->type()->is_error());
       return;
     }
 
@@ -9465,7 +9465,7 @@ Array_index_expression::do_get_tree(Translate_context* context)
   Array_type* array_type = this->array_->type()->array_type();
   if (array_type == NULL)
     {
-      gcc_assert(this->array_->type()->is_error());
+      go_assert(this->array_->type()->is_error());
       return error_mark_node;
     }
 
@@ -9609,25 +9609,25 @@ Array_index_expression::do_get_tree(Translate_context* context)
                                              capacity_tree, start_tree);
 
   tree struct_tree = this->type()->get_tree(gogo);
-  gcc_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
+  go_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
 
   VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
 
   constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
   tree field = TYPE_FIELDS(struct_tree);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
   elt->index = field;
   elt->value = value_pointer;
 
   elt = VEC_quick_push(constructor_elt, init, NULL);
   field = DECL_CHAIN(field);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
   elt->index = field;
   elt->value = fold_convert_loc(loc, TREE_TYPE(field), result_length_tree);
 
   elt = VEC_quick_push(constructor_elt, init, NULL);
   field = DECL_CHAIN(field);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__capacity") == 0);
   elt->index = field;
   elt->value = fold_convert_loc(loc, TREE_TYPE(field), result_capacity_tree);
 
@@ -9916,7 +9916,7 @@ Map_index_expression::get_map_type() const
 {
   Map_type* mt = this->map_->type()->deref()->map_type();
   if (mt == NULL)
-    gcc_assert(saw_errors());
+    go_assert(saw_errors());
   return mt;
 }
 
@@ -10129,7 +10129,7 @@ Field_reference_expression::do_type()
   if (type->is_error())
     return type;
   Struct_type* struct_type = type->struct_type();
-  gcc_assert(struct_type != NULL);
+  go_assert(struct_type != NULL);
   return struct_type->field(this->field_index_)->type();
 }
 
@@ -10142,8 +10142,8 @@ Field_reference_expression::do_check_types(Gogo*)
   if (type->is_error())
     return;
   Struct_type* struct_type = type->struct_type();
-  gcc_assert(struct_type != NULL);
-  gcc_assert(struct_type->field(this->field_index_) != NULL);
+  go_assert(struct_type != NULL);
+  go_assert(struct_type->field(this->field_index_) != NULL);
 }
 
 // Get a tree for a field reference.
@@ -10155,19 +10155,19 @@ Field_reference_expression::do_get_tree(Translate_context* context)
   if (struct_tree == error_mark_node
       || TREE_TYPE(struct_tree) == error_mark_node)
     return error_mark_node;
-  gcc_assert(TREE_CODE(TREE_TYPE(struct_tree)) == RECORD_TYPE);
+  go_assert(TREE_CODE(TREE_TYPE(struct_tree)) == RECORD_TYPE);
   tree field = TYPE_FIELDS(TREE_TYPE(struct_tree));
   if (field == NULL_TREE)
     {
       // This can happen for a type which refers to itself indirectly
       // and then turns out to be erroneous.
-      gcc_assert(saw_errors());
+      go_assert(saw_errors());
       return error_mark_node;
     }
   for (unsigned int i = this->field_index_; i > 0; --i)
     {
       field = DECL_CHAIN(field);
-      gcc_assert(field != NULL_TREE);
+      go_assert(field != NULL_TREE);
     }
   if (TREE_TYPE(field) == error_mark_node)
     return error_mark_node;
@@ -10196,16 +10196,16 @@ Interface_field_reference_expression::get_function_tree(Translate_context*,
     expr = build_fold_indirect_ref(expr);
 
   tree expr_type = TREE_TYPE(expr);
-  gcc_assert(TREE_CODE(expr_type) == RECORD_TYPE);
+  go_assert(TREE_CODE(expr_type) == RECORD_TYPE);
 
   tree field = TYPE_FIELDS(expr_type);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__methods") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__methods") == 0);
 
   tree table = build3(COMPONENT_REF, TREE_TYPE(field), expr, field, NULL_TREE);
-  gcc_assert(POINTER_TYPE_P(TREE_TYPE(table)));
+  go_assert(POINTER_TYPE_P(TREE_TYPE(table)));
 
   table = build_fold_indirect_ref(table);
-  gcc_assert(TREE_CODE(TREE_TYPE(table)) == RECORD_TYPE);
+  go_assert(TREE_CODE(TREE_TYPE(table)) == RECORD_TYPE);
 
   std::string name = Gogo::unpack_hidden_name(this->name_);
   for (field = DECL_CHAIN(TYPE_FIELDS(TREE_TYPE(table)));
@@ -10215,7 +10215,7 @@ Interface_field_reference_expression::get_function_tree(Translate_context*,
       if (name == IDENTIFIER_POINTER(DECL_NAME(field)))
        break;
     }
-  gcc_assert(field != NULL_TREE);
+  go_assert(field != NULL_TREE);
 
   return build3(COMPONENT_REF, TREE_TYPE(field), table, field, NULL_TREE);
 }
@@ -10232,10 +10232,10 @@ Interface_field_reference_expression::get_underlying_object_tree(
     expr = build_fold_indirect_ref(expr);
 
   tree expr_type = TREE_TYPE(expr);
-  gcc_assert(TREE_CODE(expr_type) == RECORD_TYPE);
+  go_assert(TREE_CODE(expr_type) == RECORD_TYPE);
 
   tree field = DECL_CHAIN(TYPE_FIELDS(expr_type));
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__object") == 0);
 
   return build3(COMPONENT_REF, TREE_TYPE(field), expr, field, NULL_TREE);
 }
@@ -10447,12 +10447,12 @@ Selector_expression::lower_method_expression(Gogo* gogo)
   if (method != NULL)
     {
       method_type = method->type();
-      gcc_assert(method_type->is_method());
+      go_assert(method_type->is_method());
     }
   else
     {
       method_type = imethod->type()->function_type();
-      gcc_assert(method_type != NULL && !method_type->is_method());
+      go_assert(method_type != NULL && !method_type->is_method());
     }
 
   const char* const receiver_name = "$this";
@@ -10509,7 +10509,7 @@ Selector_expression::lower_method_expression(Gogo* gogo)
                                          location);
 
   Named_object* vno = gogo->lookup(receiver_name, NULL);
-  gcc_assert(vno != NULL);
+  go_assert(vno != NULL);
   Expression* ve = Expression::make_var_reference(vno, location);
   Expression* bm;
   if (method != NULL)
@@ -10536,7 +10536,7 @@ Selector_expression::lower_method_expression(Gogo* gogo)
           ++p)
        {
          vno = gogo->lookup(p->name(), NULL);
-         gcc_assert(vno != NULL);
+         go_assert(vno != NULL);
          args->push_back(Expression::make_var_reference(vno, location));
        }
     }
@@ -10920,7 +10920,7 @@ Struct_construction_expression::do_check_types(Gogo*)
          this->set_is_error();
        }
     }
-  gcc_assert(pv == this->vals_->end());
+  go_assert(pv == this->vals_->end());
 }
 
 // Return a tree for constructing a struct.
@@ -10936,7 +10936,7 @@ Struct_construction_expression::do_get_tree(Translate_context* context)
   tree type_tree = this->type_->get_tree(gogo);
   if (type_tree == error_mark_node)
     return error_mark_node;
-  gcc_assert(TREE_CODE(type_tree) == RECORD_TYPE);
+  go_assert(TREE_CODE(type_tree) == RECORD_TYPE);
 
   bool is_constant = true;
   const Struct_field_list* fields = this->type_->struct_type()->fields();
@@ -10948,7 +10948,7 @@ Struct_construction_expression::do_get_tree(Translate_context* context)
        field != NULL_TREE;
        field = DECL_CHAIN(field), ++pf)
     {
-      gcc_assert(pf != fields->end());
+      go_assert(pf != fields->end());
 
       tree val;
       if (pv == this->vals_->end())
@@ -10976,7 +10976,7 @@ Struct_construction_expression::do_get_tree(Translate_context* context)
       if (!TREE_CONSTANT(val))
        is_constant = false;
     }
-  gcc_assert(pf == fields->end());
+  go_assert(pf == fields->end());
 
   tree ret = build_constructor(type_tree, elts);
   if (is_constant)
@@ -11008,7 +11008,7 @@ Expression*
 Expression::make_struct_composite_literal(Type* type, Expression_list* vals,
                                          source_location location)
 {
-  gcc_assert(type->struct_type() != NULL);
+  go_assert(type->struct_type() != NULL);
   return new Struct_construction_expression(type, vals, location);
 }
 
@@ -11245,7 +11245,7 @@ class Fixed_array_construction_expression :
     : Array_construction_expression(EXPRESSION_FIXED_ARRAY_CONSTRUCTION,
                                    type, vals, location)
   {
-    gcc_assert(type->array_type() != NULL
+    go_assert(type->array_type() != NULL
               && type->array_type()->length() != NULL);
   }
 
@@ -11283,7 +11283,7 @@ class Open_array_construction_expression : public Array_construction_expression
     : Array_construction_expression(EXPRESSION_OPEN_ARRAY_CONSTRUCTION,
                                    type, vals, location)
   {
-    gcc_assert(type->array_type() != NULL
+    go_assert(type->array_type() != NULL
               && type->array_type()->length() == NULL);
   }
 
@@ -11312,7 +11312,7 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
   Array_type* array_type = this->type()->array_type();
   if (array_type == NULL)
     {
-      gcc_assert(this->type()->is_error());
+      go_assert(this->type()->is_error());
       return error_mark_node;
     }
 
@@ -11413,25 +11413,25 @@ Open_array_construction_expression::do_get_tree(Translate_context* context)
   tree type_tree = this->type()->get_tree(context->gogo());
   if (type_tree == error_mark_node)
     return error_mark_node;
-  gcc_assert(TREE_CODE(type_tree) == RECORD_TYPE);
+  go_assert(TREE_CODE(type_tree) == RECORD_TYPE);
 
   VEC(constructor_elt,gc)* init = VEC_alloc(constructor_elt, gc, 3);
 
   constructor_elt* elt = VEC_quick_push(constructor_elt, init, NULL);
   tree field = TYPE_FIELDS(type_tree);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__values") == 0);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), space);
 
   elt = VEC_quick_push(constructor_elt, init, NULL);
   field = DECL_CHAIN(field);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)), "__count") == 0);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), length_tree);
 
   elt = VEC_quick_push(constructor_elt, init, NULL);
   field = DECL_CHAIN(field);
-  gcc_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),"__capacity") == 0);
+  go_assert(strcmp(IDENTIFIER_POINTER(DECL_NAME(field)),"__capacity") == 0);
   elt->index = field;
   elt->value = fold_convert(TREE_TYPE(field), length_tree);
 
@@ -11454,7 +11454,7 @@ Expression*
 Expression::make_slice_composite_literal(Type* type, Expression_list* vals,
                                         source_location location)
 {
-  gcc_assert(type->is_open_array_type());
+  go_assert(type->is_open_array_type());
   return new Open_array_construction_expression(type, vals, location);
 }
 
@@ -11467,7 +11467,7 @@ class Map_construction_expression : public Expression
                              source_location location)
     : Expression(EXPRESSION_MAP_CONSTRUCTION, location),
       type_(type), vals_(vals)
-  { gcc_assert(vals == NULL || vals->size() % 2 == 0); }
+  { go_assert(vals == NULL || vals->size() % 2 == 0); }
 
  protected:
   int
@@ -11874,7 +11874,7 @@ Composite_literal_expression::lower_struct(Gogo* gogo, Type* type)
       Expression* name_expr = *p;
 
       ++p;
-      gcc_assert(p != this->vals_->end());
+      go_assert(p != this->vals_->end());
       Expression* val = *p;
 
       ++p;
@@ -12030,7 +12030,7 @@ Composite_literal_expression::lower_array(Type* type)
       Expression* index_expr = *p;
 
       ++p;
-      gcc_assert(p != this->vals_->end());
+      go_assert(p != this->vals_->end());
       Expression* val = *p;
 
       ++p;
@@ -12179,7 +12179,7 @@ Composite_literal_expression::lower_map(Gogo* gogo, Named_object* function,
            {
              (*p)->unknown_expression()->clear_is_composite_literal_key();
              gogo->lower_expression(function, &*p);
-             gcc_assert((*p)->is_error_expression());
+             go_assert((*p)->is_error_expression());
              return Expression::make_error(location);
            }
        }
@@ -12425,7 +12425,7 @@ Heap_composite_expression::do_get_tree(Translate_context* context)
   if (expr_tree == error_mark_node)
     return error_mark_node;
   tree expr_size = TYPE_SIZE_UNIT(TREE_TYPE(expr_tree));
-  gcc_assert(TREE_CODE(expr_size) == INTEGER_CST);
+  go_assert(TREE_CODE(expr_size) == INTEGER_CST);
   tree space = context->gogo()->allocate_memory(this->expr_->type(),
                                                expr_size, this->location());
   space = fold_convert(build_pointer_type(TREE_TYPE(expr_tree)), space);
@@ -12491,7 +12491,7 @@ Receive_expression::do_get_tree(Translate_context* context)
   Channel_type* channel_type = this->channel_->type()->channel_type();
   if (channel_type == NULL)
     {
-      gcc_assert(this->channel_->type()->is_error());
+      go_assert(this->channel_->type()->is_error());
       return error_mark_node;
     }
   Type* element_type = channel_type->element_type();
@@ -12618,7 +12618,7 @@ Type_info_expression::do_get_tree(Translate_context* context)
     return error_mark_node;
 
   tree val_type_tree = this->type()->get_tree(context->gogo());
-  gcc_assert(val_type_tree != error_mark_node);
+  go_assert(val_type_tree != error_mark_node);
 
   if (this->type_info_ == TYPE_INFO_SIZE)
     return fold_convert_loc(BUILTINS_LOCATION, val_type_tree,
@@ -12687,7 +12687,7 @@ Struct_field_offset_expression::do_get_tree(Translate_context* context)
     return error_mark_node;
 
   tree val_type_tree = this->type()->get_tree(context->gogo());
-  gcc_assert(val_type_tree != error_mark_node);
+  go_assert(val_type_tree != error_mark_node);
 
   const Struct_field_list* fields = this->type_->fields();
   tree struct_field_tree = TYPE_FIELDS(type_tree);
@@ -12696,11 +12696,11 @@ Struct_field_offset_expression::do_get_tree(Translate_context* context)
        p != fields->end();
        ++p, struct_field_tree = DECL_CHAIN(struct_field_tree))
     {
-      gcc_assert(struct_field_tree != NULL_TREE);
+      go_assert(struct_field_tree != NULL_TREE);
       if (&*p == this->field_)
        break;
     }
-  gcc_assert(&*p == this->field_);
+  go_assert(&*p == this->field_);
 
   return fold_convert_loc(BUILTINS_LOCATION, val_type_tree,
                          byte_position(struct_field_tree));