js_of_ocaml icon indicating copy to clipboard operation
js_of_ocaml copied to clipboard

Bugfix in ocamlyacc runtime code

Open mlasson opened this issue 3 years ago • 4 comments

Description

The parsing module runtime has a bug in parsing.js.

In happened in the "ERROR_DETECTED" case. There's a break instruction that is breaking a for loop instead of breaking a switch. Which makes the "flow" fall through the "SHIFT" case instead of the "SHIFT_RECOVER" case.

This PR adds a label to fix this.

Here is a reproduction case, https://github.com/mlasson/js-yacc-bug

mlasson avatar Sep 19 '22 08:09 mlasson

Can we include the repro case as well ?

hhugo avatar Sep 19 '22 09:09 hhugo

Where do you want to include it ? In a PR description ? In a test ? In a comment ? But, sure, yes, feel free.

mlasson avatar Sep 19 '22 09:09 mlasson

Where do you want to include it ? In a PR description ? In a test ? In a comment ? But, sure, yes, feel free.

I can add a test myself if you want. In that case, should I add a directory tests-ocamlyacc in the compiler directory ?

mlasson avatar Sep 19 '22 09:09 mlasson

I

Where do you want to include it ? In a PR description ? In a test ? In a comment ? But, sure, yes, feel free.

I can add a test myself if you want. In that case, should I add a directory tests-ocamlyacc in the compiler directory ?

Adding it in compiler/tests-jsoo would make it run in both native and js. I would also be a good place to make sure https://github.com/ocsigen/js_of_ocaml/pull/1308 follows the native version.

hhugo avatar Sep 19 '22 10:09 hhugo

@mlasson, Gentle ping

hhugo avatar Oct 04 '22 09:10 hhugo

Adding test in https://github.com/ocsigen/js_of_ocaml/pull/1315

hhugo avatar Oct 14 '22 15:10 hhugo

Thanks

mlasson avatar Oct 14 '22 16:10 mlasson