shithub: scc

Download patch

ref: 7dd517166fa92d4fd8d57599b50d8b9394eea693
parent: 47e042802dd3438d7a009a30aaf73bbb7bc7ffed
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jan 26 10:26:31 EST 2016

[cc1] Do not include the \0 in initialized strings

The target string is initialized to \0, so we don't have to
include explicitily the \0, because in this cause it was
incrementing the size of the target in 1.

--- a/cc1/init.c
+++ b/cc1/init.c
@@ -120,7 +120,7 @@
 			errorp("array of inappropriate type initialized from string constant");
 			goto return_zero;
 		}
-		len = sym->type->n.elem;
+		len = sym->type->n.elem-1;
 		if (!tp->defined) {
 			tp->defined = 1;
 			tp->n.elem = len+1;