shithub: libmujs

Download patch

ref: c8934909e072db256debe9f3a28f4451b1844603
parent: f0ed0d0ba351c152e97ed91a4f77a91f50735dd9
author: Tor Andersson <[email protected]>
date: Mon Jun 19 07:50:13 EDT 2017

Silence a few compiler warnings for harmless, impossible cases.

The 'save' variable is *always* set before it's accessed, but the logic
is too difficult for gcc to trace.

node->m is always > 0, but the compiler has no way of knowing.

--- a/regexp.c
+++ b/regexp.c
@@ -251,7 +251,7 @@
 {
 	int type = L_CCLASS;
 	int quoted, havesave, havedash;
-	Rune save;
+	Rune save = 0;
 
 	newcclass(g);
 
@@ -654,6 +654,7 @@
 		break;
 
 	case P_REP:
+		inst = NULL; /* silence compiler warning. assert(node->m > 0). */
 		for (i = 0; i < node->m; ++i) {
 			inst = prog->end;
 			compile(prog, node->x);