scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 89ce7731fc48c5e3d374ef3082da7958a0e4bc49
parent 4e6fb511b31c7d113f56e968c952575cb0130df3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 31 Mar 2022 13:35:18 +0200

cc2/qbe: Use unsigned char for asm codes

asm codes can go over 127, and it means that depending
in the ABI they can suffer sign extension that can
generate problems.

Diffstat:
Msrc/cmd/cc/cc2/target/qbe/cgen.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/cmd/cc/cc2/target/qbe/cgen.c b/src/cmd/cc/cc2/target/qbe/cgen.c @@ -7,7 +7,7 @@ #include "arch.h" #include "../../cc2.h" -static char opasmw[][2] = { +static unsigned char opasmw[][2] = { [OADD] = {ASADDW, ASADDW}, [OSUB] = {ASSUBW, ASSUBW}, [OMUL] = {ASMULW, ASMULW}, @@ -26,7 +26,7 @@ static char opasmw[][2] = { [OBXOR] = {ASBXORW, ASBXORW}, }; -static char opasml[][2] = { +static unsigned char opasml[][2] = { [OADD] = {ASADDL, ASADDL}, [OSUB] = {ASSUBL, ASSUBL}, [OMUL] = {ASMULL, ASMULL}, @@ -45,7 +45,7 @@ static char opasml[][2] = { [OBXOR] = {ASBXORL, ASBXORL}, }; -static char opasms[][2] = { +static unsigned char opasms[][2] = { [OADD] = {ASADDS, ASADDS}, [OSUB] = {ASSUBS, ASSUBS}, [OMUL] = {ASMULS, ASMULS}, @@ -58,7 +58,7 @@ static char opasms[][2] = { [ONE] = {ASNES, ASNES}, }; -static char opasmd[][2] = { +static unsigned char opasmd[][2] = { [OADD] = {ASADDD, ASADDD}, [OSUB] = {ASSUBD, ASSUBD}, [OMUL] = {ASMULD, ASMULD}, @@ -71,7 +71,7 @@ static char opasmd[][2] = { [ONE] = {ASNED, ASNED}, }; -static char (*opbin[][2])[2] = { +static unsigned char (*opbin[][2])[2] = { {opasmw, opasml}, {opasms, opasmd}, };