This code used local variable 'out' as if its value stayed the same from
one iteration of the loop to the next, but in fact its scope meant that
it became indeterminate on each new iteration. This commit fixes the
problem by moving its declaration to an outer scope.
Thanks to John Darrington for reporting the problem.
lex_source_get_lookahead (struct lex_source *src)
{
struct merger m = MERGER_INIT;
+ struct token out;
for (size_t i = 0; ; i++)
{
while (lex_stage_count (&src->merge) <= i && !lex_source_get_merge (src))
return false;
}
- struct token out;
int retval = merger_add (&m, &lex_stage_nth (&src->merge, i)->token,
&out);
if (!retval)