+2012-01-21 Ian Lance Taylor <iant@google.com>
+
+ * go-gcc.cc (Gcc_backend::type_size): Check for error_mark_node.
+ (Gcc_backend::type_alignment): Likewise.
+ (Gcc_backend::type_field_alignment): Likewise.
+ (Gcc_backend::type_field_offset): Likewise.
+
2012-01-20 Ian Lance Taylor <iant@google.com>
* go-gcc.cc (Gcc_backend::placeholder_struct_type): Permit name to
size_t
Gcc_backend::type_size(Btype* btype)
{
- tree t = TYPE_SIZE_UNIT(btype->get_tree());
+ tree t = btype->get_tree();
+ if (t == error_mark_node)
+ return 1;
+ t = TYPE_SIZE_UNIT(t);
gcc_assert(TREE_CODE(t) == INTEGER_CST);
gcc_assert(TREE_INT_CST_HIGH(t) == 0);
unsigned HOST_WIDE_INT val_wide = TREE_INT_CST_LOW(t);
size_t
Gcc_backend::type_alignment(Btype* btype)
{
- return TYPE_ALIGN_UNIT(btype->get_tree());
+ tree t = btype->get_tree();
+ if (t == error_mark_node)
+ return 1;
+ return TYPE_ALIGN_UNIT(t);
}
// Return the alignment of a struct field of type BTYPE.
size_t
Gcc_backend::type_field_alignment(Btype* btype)
{
- return go_field_alignment(btype->get_tree());
+ tree t = btype->get_tree();
+ if (t == error_mark_node)
+ return 1;
+ return go_field_alignment(t);
}
// Return the offset of a field in a struct.
Gcc_backend::type_field_offset(Btype* btype, size_t index)
{
tree struct_tree = btype->get_tree();
+ if (struct_tree == error_mark_node)
+ return 0;
gcc_assert(TREE_CODE(struct_tree) == RECORD_TYPE);
tree field = TYPE_FIELDS(struct_tree);
for (; index > 0; --index)