[hackers] [scc] Reserve always an identifier for labels || Roberto E. Vargas Caballero
commit cfd05d23cb1e3716f9d59e1ad95bbb29c4da713b
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 14 22:02:23 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 14 22:02:23 2015 +0200
Reserve always an identifier for labels
Labels are always emitted, so they must have an identifier
always. Before this patch temporal labels were not installed
because they don't have name, and it caused that all the
temporal labels hadn't an identifier, they were emitted
as L0.
diff --git a/cc1/symbol.c b/cc1/symbol.c
index f780281..66f50a2 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -166,6 +166,7 @@ newsym(unsigned ns)
return sym;
if (ns == NS_LABEL) {
sym->next = labels;
+ sym->id = ++localcnt;
return labels = sym;
}
_AT_@ -260,7 +261,7 @@ install(unsigned ns, Symbol *sym)
sym = linkhash(newsym(ns), sym->name);
assign_id:
- if (sym->ns != NS_CPP)
+ if (sym->ns != NS_CPP || sym->ns != NS_LABEL)
sym->id = (curctx) ? ++localcnt : ++globalcnt;
return sym;
diff --git a/cc1/tests/test004.c b/cc1/tests/test004.c
index 0698a52..292b71a 100644
--- a/cc1/tests/test004.c
+++ b/cc1/tests/test004.c
_AT_@ -22,9 +22,9 @@ A2 I x
A2 A2 A2 #I3 <I #I1 #I0 ?I +I :I
A2 A2 A2 #I1 >I #I1 #I0 ?I +I :I
A2 A2 A2 #I4 <I #I1 #I0 ?I +I :I
- j L0 A2 #I4 =I
+ j L3 A2 #I4 =I
yI #I1
-L0
+L3
yI #I0
}
*/
_AT_@ -52,4 +52,4 @@ main()
if(x != 4)
return 1;
return 0;
-}
\ No newline at end of file
+}
diff --git a/cc1/tests/test005.c b/cc1/tests/test005.c
index 762f051..f90e65a 100644
--- a/cc1/tests/test005.c
+++ b/cc1/tests/test005.c
_AT_@ -12,9 +12,9 @@ A2 I x
A2 A2 #I0 =I #I1 #I0 ?I :I
A2 A2 ~I :I
A2 A2 _I :I
- j L0 A2 #I2 =I
+ j L3 A2 #I2 =I
yI #I1
-L0
+L3
yI #I0
}
*/
Received on Fri Aug 14 2015 - 23:22:50 CEST
This archive was generated by hypermail 2.3.0
: Fri Aug 14 2015 - 23:24:12 CEST