Luc Van Oostenryck <lucvoo@xxxxxxxxxx> writes: >> $ git diff >> diff --git a/validation/restrict-array.c b/validation/restrict-array.c >> index 04bfdad9..86753b7d 100644 >> --- a/validation/restrict-array.c >> +++ b/validation/restrict-array.c >> @@ -29,9 +29,19 @@ typedef unsigned long int size_t; >> >> extern int regexec (const regex_t *__restrict __preg, >> const char *__restrict __string, size_t __nmatch, >> - regmatch_t __pmatch[__restrict_arr], >> + regmatch_t __pmatch[__restrict_arr __nmatch], >> int __eflags); > > ... > >> which, similarly to git, shows errors not on the declaration of the >> regexec() function, but on each call site (about a dozen in git): >> >> $ ./sparse validation/restrict-array.c >> validation/restrict-array.c:32:56: error: undefined identifier '__nmatch' >> validation/restrict-array.c:32:56: error: bad constant expression type > > Yes, it's because __nmatch should be in the function's prototype scope but > Sparse hasn't such a thing. > > The following patch is a bit ugly but should solve the problem here above. > It's hasn't had much testing, only the testsuite. The same breakage came up recently on the Git mailing list. https://lore.kernel.org/git/xmqqikx42c42.fsf@gitster.g/ The patch seems to fix the problem when locally applyed to the tip at v0.6.4-67-g3a4c5743 (of course we have to add -Wno-vla in our Makefile when invoking sparse). Any plan to polish it to "unugly" it and merge? Thanks.