onetrueawk / awk

One true awk
Other
1.96k stars 156 forks source link

Correctly reset the goto table for a state. #200

Closed millert closed 9 months ago

millert commented 9 months ago

We cannot use set_gototab() to reset all the entries for a state, it will leave existing entries as-is. Add a new reset_gototab() function that zeroes the table entries for the specified state. There is no need to reset the goto table immediately after resize_state(), it is already initialized via calloc().

millert commented 9 months ago

This has been confirmed by @enh-google to fix #199

plan9 commented 9 months ago

This has been confirmed by @enh-google to fix #199

I can reproduce the problem trivially. I know for a fact that this PR cannot fix #199. as per kernighan's note, it has to do with the size of the gototab.

enh-google commented 9 months ago

This has been confirmed by @enh-google to fix #199

I can reproduce the problem trivially. I know for a fact that this PR cannot fix #199. as per kernighan's note, it has to do with the size of the gototab.

well, having tested this patch with the specific input that caused me to raise #199, it definitely does fix that issue. it may introduce other problems, but nothing that our testing finds. do you have an example input that fails with this patch?