scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 33d48f1302e23a91f0835080c8b00372051026c4
parent a300bb7984c6d77b298981e1c6d6be00b4ab56b3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 26 Jan 2016 12:46:06 +0100

[cc1] Remove call to strlen() in initialize()

The result of this call can be obtained from the own type, and in
some cases ("foo\0") the call to strlen can give incorrect values.

Diffstat:
Mcc1/init.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

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