aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDave Brolley <brolley@cygnus.com>1998-08-31 12:35:32 +0000
committerDave Brolley <brolley@gcc.gnu.org>1998-08-31 08:35:32 -0400
commit058ebd7ee688d8efe6f3d7c2b299a514cda225c2 (patch)
tree2c82a808aa877c6b086cd71917685e20e30227b0 /gcc
parentf82b6a6b7590ed896f2d044be47125439053004b (diff)
downloadgcc-058ebd7ee688d8efe6f3d7c2b299a514cda225c2.zip
gcc-058ebd7ee688d8efe6f3d7c2b299a514cda225c2.tar.gz
gcc-058ebd7ee688d8efe6f3d7c2b299a514cda225c2.tar.bz2
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
Diffstat (limited to 'gcc')
-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 9c930f5..60bd144 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 57842b0..83e1a05 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))