/* Build expressions with type checking for C compiler.
- Copyright (C) 1987, 88, 91, 92-5, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 91-6, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
/* Step through all anon unions in linear fashion. */
while (DECL_NAME (field_array[bot]) == NULL_TREE)
{
- tree anon, junk;
+ tree anon = 0, junk;
field = field_array[bot++];
- anon = lookup_field (TREE_TYPE (field), component, &junk);
+ if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
+ || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ anon = lookup_field (TREE_TYPE (field), component, &junk);
+
if (anon != NULL_TREE)
{
*indirect = field;
if (DECL_NAME (field) == NULL_TREE)
{
tree junk;
- tree anon = lookup_field (TREE_TYPE (field), component, &junk);
+ tree anon = 0;
+
+ if (TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE
+ || TREE_CODE (TREE_TYPE (field)) == UNION_TYPE)
+ anon = lookup_field (TREE_TYPE (field), component, &junk);
+
if (anon != NULL_TREE)
{
*indirect = field;
error ("dereferencing pointer to incomplete type");
return error_mark_node;
}
- if (TREE_CODE (t) == VOID_TYPE)
+ if (TREE_CODE (t) == VOID_TYPE && skip_evaluation == 0)
warning ("dereferencing `void *' pointer");
/* We *must* set TREE_READONLY when dereferencing a pointer to const,
error_init ("duplicate array index in initializer%s", " for `%s'", NULL);
else
{
- TREE_INT_CST_LOW (constructor_index)
- = TREE_INT_CST_LOW (first);
- TREE_INT_CST_HIGH (constructor_index)
- = TREE_INT_CST_HIGH (first);
+ TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (first);
+ TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (first);
if (last != 0 && tree_int_cst_lt (last, first))
error_init ("empty index range in initializer%s", " for `%s'", NULL);
&& constructor_fields == 0)
process_init_element (pop_init_level (1));
else if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && tree_int_cst_lt (constructor_max_index, constructor_index))
+ && (constructor_max_index == 0
+ || tree_int_cst_lt (constructor_max_index,
+ constructor_index)))
process_init_element (pop_init_level (1));
else
break;
/* In the case of [LO .. HI] = VALUE, only evaluate VALUE once. */
if (constructor_range_end)
- value = save_expr (value);
+ {
+ if (constructor_max_index != 0
+ && tree_int_cst_lt (constructor_max_index,
+ constructor_range_end))
+ {
+ pedwarn_init ("excess elements in array initializer%s",
+ " after `%s'", NULL_PTR);
+ TREE_INT_CST_HIGH (constructor_range_end)
+ = TREE_INT_CST_HIGH (constructor_max_index);
+ TREE_INT_CST_LOW (constructor_range_end)
+ = TREE_INT_CST_LOW (constructor_max_index);
+ }
+
+ value = save_expr (value);
+ }
/* Now output the actual element.
Ordinarily, output once.
tem = size_binop (PLUS_EXPR, constructor_index,
integer_one_node);
- TREE_INT_CST_LOW (constructor_index)
- = TREE_INT_CST_LOW (tem);
- TREE_INT_CST_HIGH (constructor_index)
- = TREE_INT_CST_HIGH (tem);
+ TREE_INT_CST_LOW (constructor_index) = TREE_INT_CST_LOW (tem);
+ TREE_INT_CST_HIGH (constructor_index) = TREE_INT_CST_HIGH (tem);
if (!value)
/* If we are doing the bookkeeping for an element that was