shithub: scc

Download patch

ref: 454f06c1318b499daa5fd441e4053f749bb111d1
parent: a69a08db850e632d1809320b6abbaca181354216
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Sep 27 18:20:11 EDT 2017

[as] Fix type of fields in struct op

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

--- a/as/as.h
+++ b/as/as.h
@@ -67,7 +67,7 @@
 	unsigned char flags;
 	char size;
 	void (*format)(Op *, Node **);
-	char *bytes;
+	unsigned char *bytes;
 	unsigned char *args;
 };
 
--- a/as/target/gen.awk
+++ b/as/target/gen.awk
@@ -48,12 +48,12 @@
 			       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},"
 		}