decl.c (layout_chill_variants): Calculate nlables properly.
Mon Aug 31 15:35:16 1998 Dave Brolley <brolley@cygnus.com> * decl.c (layout_chill_variants): Calculate nlables properly. From-SVN: r22130
This commit is contained in:
parent
f82b6a6b75
commit
058ebd7ee6
@ -1,3 +1,7 @@
|
||||
Mon Aug 31 15:35:16 1998 Dave Brolley <brolley@cygnus.com>
|
||||
|
||||
* decl.c (layout_chill_variants): Calculate nlables properly.
|
||||
|
||||
Mon Jul 27 17:21:01 1998 Dave Brolley <brolley@cygnus.com>
|
||||
|
||||
* typeck.c (apply_chill_array_layout): Don't set TYPE_SIZE of the
|
||||
|
@ -1690,7 +1690,7 @@ layout_chill_variants (utype)
|
||||
tree utype;
|
||||
{
|
||||
tree first = TYPE_FIELDS (utype);
|
||||
int nlabels = 0, label_index = 0;
|
||||
int nlabels, label_index = 0;
|
||||
struct tree_pair *label_value_array;
|
||||
tree decl;
|
||||
extern int errorcount;
|
||||
@ -1746,7 +1746,6 @@ layout_chill_variants (utype)
|
||||
error_with_decl (TYPE_FIELDS (t),
|
||||
"inconsistent modes between labels and tag field");
|
||||
}
|
||||
nlabels++;
|
||||
}
|
||||
}
|
||||
if (tagfields != NULL_TREE)
|
||||
@ -1755,6 +1754,21 @@ layout_chill_variants (utype)
|
||||
error ("too many tag labels");
|
||||
}
|
||||
|
||||
/* Compute the number of labels to be checked for duplicates. */
|
||||
nlabels = 0;
|
||||
for (decl = first; decl; decl = TREE_CHAIN (decl))
|
||||
{
|
||||
tree t = TREE_TYPE (decl);
|
||||
/* Only one tag (first case_label_list) supported, for now. */
|
||||
tree labellist = TYPE_TAG_VALUES (t);
|
||||
if (labellist)
|
||||
labellist = TREE_VALUE (labellist);
|
||||
|
||||
for (; labellist != NULL_TREE; labellist = TREE_CHAIN (labellist))
|
||||
if (TREE_CODE (TREE_VALUE (labellist)) == INTEGER_CST)
|
||||
nlabels++;
|
||||
}
|
||||
|
||||
/* Check for duplicate label values. */
|
||||
label_value_array = (struct tree_pair *)alloca (nlabels * sizeof (struct tree_pair));
|
||||
for (decl = first; decl; decl = TREE_CHAIN (decl))
|
||||
|
Loading…
Reference in New Issue
Block a user