summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--appl/cmd/limbo/com.b13
-rw-r--r--dis/limbo.disbin343202 -> 343331 bytes
-rw-r--r--limbo/com.c17
4 files changed, 30 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index e97ba70b..c52e1aaf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
20110404
update Nt/386/bin
+ /limbo/com.c - count constants in qualifiers, not qualifiers [issue 212, mechiel]
+ /appl/cmd/limbo/com.b [also issue 212]
20110403
secstore(2) and secstore(1) updated to implement writing [issue 256, mechiel]
20110402
diff --git a/appl/cmd/limbo/com.b b/appl/cmd/limbo/com.b
index 320d209c..383fc1a6 100644
--- a/appl/cmd/limbo/com.b
+++ b/appl/cmd/limbo/com.b
@@ -734,6 +734,17 @@ fillrange(c: ref Case, nn: ref Node, in: ref Inst)
l[i++].inst = in;
}
+nconstqual(s1: ref Node): int
+{
+ n := 0;
+ for(; s1 != nil; s1 = s1.right){
+ for(s2 := s1.left.left; s2 != nil; s2 = s2.right)
+ if(s2.left.op == Oconst)
+ n++;
+ }
+ return n;
+}
+
casecom(cn: ref Node)
{
d: ref Decl;
@@ -742,7 +753,7 @@ casecom(cn: ref Node)
c := cn.ty.cse;
- needwild := cn.op != Opick || c.nlab != cn.left.right.ty.tof.decl.tag;
+ needwild := cn.op != Opick || nconstqual(cn.right) != cn.left.right.ty.tof.decl.tag;
igoto := cn.left.ty == tint && dogoto(c);
#
diff --git a/dis/limbo.dis b/dis/limbo.dis
index 4d3616f6..72b54cc2 100644
--- a/dis/limbo.dis
+++ b/dis/limbo.dis
Binary files differ
diff --git a/limbo/com.c b/limbo/com.c
index 967d17b0..1571045c 100644
--- a/limbo/com.c
+++ b/limbo/com.c
@@ -768,6 +768,21 @@ fillrange(Case *c, Node *nn, Inst *in)
l[i++].inst = in;
}
+static int
+nconstqual(Node *s1)
+{
+ Node *s2;
+ int n;
+
+ n = 0;
+ for(; s1 != nil; s1 = s1->right){
+ for(s2 = s1->left->left; s2 != nil; s2 = s2->right)
+ if(s2->left->op == Oconst)
+ n++;
+ }
+ return n;
+}
+
void
casecom(Node *cn)
{
@@ -783,7 +798,7 @@ casecom(Node *cn)
c = cn->ty->cse;
- needwild = cn->op != Opick || c->nlab != cn->left->right->ty->tof->decl->tag;
+ needwild = cn->op != Opick || nconstqual(cn->right) != cn->left->right->ty->tof->decl->tag;
igoto = cn->left->ty == tint && dogoto(c);
j1 = j2 = nil;