scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit b075adfa058f48a924c14412c6695d35be1b968f
parent 967951ff9fb1901301a9f4bf2cc54ec36b52d599
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 27 Sep 2017 22:20:11 +0200

[as] Fix type of fields in struct op

These fields must be unsigned or otherwise we can undesired sign
extension.

Diffstat:
Mas/as.h | 2+-
Mas/target/gen.awk | 4++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/as/as.h b/as/as.h @@ -67,7 +67,7 @@ struct op { unsigned char flags; char size; void (*format)(Op *, Node **); - char *bytes; + unsigned char *bytes; unsigned char *args; }; diff --git a/as/target/gen.awk b/as/target/gen.awk @@ -48,12 +48,12 @@ END { opsize[i], opformat[i] if (opbytes[i] != "") - printf "\t\t.bytes = (char []) {%s},\n", + printf "\t\t.bytes = (unsigned char []) {%s},\n", opbytes[i] a = str2args(opargs[i]) if (a != "") - printf "\t\t.args = (char []) {%s}\n", a + printf "\t\t.args = (unsigned char []) {%s}\n", a print "\t}," }