diff --git a/src/expand.c b/src/expand.c
index 912384d..8c8bf0e 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -1914,7 +1914,7 @@ static int pmatch(char *pattern, const char *string)
 			if (c == '?' || c == '[')
 				c = CTLESC;
 			for (;;) {
-				if (c != CTLESC) {
+				if (c != (char)CTLESC) {
 					/* Stop should be null-terminated
 					 * as it is passed as a string to
 					 * strpbrk(3).
@@ -1985,7 +1985,7 @@ static int pmatch(char *pattern, const char *string)
 					p++;
 					if (*p == (char)CTLESC)
 						p++;
-					else if (*p == CTLMBCHAR) {
+					else if (*p == (char)CTLMBCHAR) {
 						mbp = mbnext(p);
 						p += mbp & 0xff;
 						p += mbp >> 8;
diff --git a/src/parser.c b/src/parser.c
index eb402a7..5714958 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1240,7 +1240,7 @@ checkend: {
 
 		markloc = out - (char *)stackblock();
 		for (p = eofmark; STPUTC(c, out), *p; p++) {
-			if (c != *p)
+			if (c != (signed char)*p)
 				goto more_heredoc;
 
 			c = pgetc();