New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault in ocamllex-generated code using 'shortest' #7760
Comments
Comment author: @alainfrisch FWIW, using "ocamllex -ml" seems to work (at least, no segfault). |
Comment author: @let-def I started investigating this issue. The problem triggers when one branch capture sub-values (the The automaton produced is correct (though not minimal :)), that's why the If you don't capture sub-values, the lexer will use the However, if one of the branch capture sub-values, Btw, this is not an initialization issue (one could think that the position vector is too short), it is because of the wrong interpretation of a tag which consumes garbage values and writes at some arbitrary offset of lex_mem. My next step will be to instrument bytecode generation to understand what goes wrong, but I progress slowly as I found few resources on that part :). |
Comment author: @let-def xclerc: sometimes the random write corrupts the heap, sometimes it doesn't. You will have to test in different memory conditions (and for good measures, put an assertion in run_tag to check for the bounds). |
Comment author: @xavierleroy Maybe @maranget could look into this issue as well. |
Comment author: @maranget I am having a look. |
Comment author: @maranget I think I have found the bug, but I am lacking time to submit Basically, the problem originates from the table compaction function being |
Original bug ID: 7760
Reporter: @stedolan
Assigned to: @maranget
Status: resolved (set by @maranget on 2018-04-10T09:05:11Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.06.0
Fixed in version: 4.07.0+dev/beta2/rc1/rc2
Category: tools (ocaml{lex,yacc,dep,debug,...})
Monitored by: @nojb @gasche @maranget
Bug description
On my machine (amd64 Debian), the following program usually segfaults:
when compiled and run as:
This example is reduced from a larger lexer. The segfault only seems to occur when using 'shortest' instead of 'parse', but I'm not sure exactly which combination of features triggers the bug. The problem is reproducible using OCaml versions back to at least 3.11.2.
The text was updated successfully, but these errors were encountered: