From: Bob Rogers <[EMAIL PROTECTED]> Date: Mon, 5 Nov 2007 22:00:10 -0500
From: François PERRAD <[EMAIL PROTECTED]> Date: Mon, 05 Nov 2007 12:06:39 +0100 >>2) Directive .const with empty string I think it's bug too, I don't understand the limitation : everything except empty string Francois Definitely a bug; the attached patch seems to fix it. If you would kindly confirm that it works, I'll add a proper test case. (Any ideas where such a test case should go?) Oops; try this one instead. -- Bob
* compilers/imcc/imcc.y: + (mk_pmc_const): Fix strlen bug, which broke empty strings. * compilers/imcc/imcparser.c: + Fix translated version. Diffs between last version checked in and current workfile(s): Index: compilers/imcc/imcc.y =================================================================== --- compilers/imcc/imcc.y (revision 22692) +++ compilers/imcc/imcc.y (working copy) @@ -223,9 +223,9 @@ ascii = (*constant == '\'' || *constant == '"'); if (ascii) { /* strip delimiters */ - const size_t len = strlen(constant); + const size_t len = strlen(constant)+1; name = (char *)mem_sys_allocate(len); - constant[len - 1] = '\0'; + constant[len - 2] = '\0'; strcpy(name, constant + 1); free(constant); Index: compilers/imcc/imcparser.c =================================================================== --- compilers/imcc/imcparser.c (revision 22692) +++ compilers/imcc/imcparser.c (working copy) @@ -541,9 +541,9 @@ ascii = (*constant == '\'' || *constant == '"'); if (ascii) { /* strip delimiters */ - const size_t len = strlen(constant); + const size_t len = strlen(constant)+1; name = (char *)mem_sys_allocate(len); - constant[len - 1] = '\0'; + constant[len - 2] = '\0'; strcpy(name, constant + 1); free(constant); End of diffs.