summaryrefslogtreecommitdiff
path: root/gcc/ch
diff options
context:
space:
mode:
authorbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>1998-08-31 12:35:32 +0000
committerbrolley <brolley@138bc75d-0d04-0410-961f-82ee72b054a4>1998-08-31 12:35:32 +0000
commit323009606a96187255772296ba243cab98f4c76c (patch)
tree2c82a808aa877c6b086cd71917685e20e30227b0 /gcc/ch
parent8835a08de89ef34f407fbe9dd2728a47c2c1a604 (diff)
downloadgcc-323009606a96187255772296ba243cab98f4c76c.tar.gz
Mon Aug 31 15:35:16 1998 Dave Brolley <brolley@cygnus.com>
* decl.c (layout_chill_variants): Calculate nlables properly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22130 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ch')
-rw-r--r--gcc/ch/ChangeLog4
-rw-r--r--gcc/ch/decl.c18
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog
index 9c930f5fd69..60bd144aca8 100644
--- a/gcc/ch/ChangeLog
+++ b/gcc/ch/ChangeLog
@@ -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
diff --git a/gcc/ch/decl.c b/gcc/ch/decl.c
index 57842b03984..83e1a053a2a 100644
--- a/gcc/ch/decl.c
+++ b/gcc/ch/decl.c
@@ -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))