shithub: scc

Download patch

ref: c31a2b36325ec5d3d82ce24209a5c7f5f9a8c041
parent: e4e130d48a89642db29f4aefbb8a416bbfe60abe
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jan 19 14:28:23 EST 2016

Check maximum position in the initializer after increment

Max will keep the maximum size of the initializer, so it must compared
after the increment, no before

--- a/cc1/init.c
+++ b/cc1/init.c
@@ -251,10 +251,10 @@
 		else
 			newdesig(&in, np);
 
-		if (in.pos > in.max)
-			in.max = in.pos;
 		if (++in.pos == 0)
 			errorp("compound literal too big");
+		if (in.pos > in.max)
+			in.max = in.pos;
 		if (tp->n.elem == in.pos && !braces)
 			break;
 	} while (accept(','));