-
Notifications
You must be signed in to change notification settings - Fork 397
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
Location Parsing Bug #7905
Location Parsing Bug #7905
Comments
The exception is raised by dune/otherlibs/stdune/src/loc.ml Line 72 in 3647393
len < 0 . If the start and stop positions are not guaranteed to be coherent (ie the byte offset of start to be at most that of stop ), then this looks like an actual bug?
|
Indeed. Although I'd argue that we shouldn't crash on invalid locations regardless. |
Indeed, this looks like a bug on a local branch of the OCaml compiler exactly as @nojb described. The start position exceeds the end position.
I don't have evidence to suggest this compiler bug is present in the upstream OCaml compiler. But I would guess that, if you're developing a feature on a branch of the OCaml compiler, it's likely enough that you'll write a bug where the compiler starts producing invalid locations. |
What should we do with an invalid location? Warn the user? Or just ignore it and try our best? |
Upon some more investigation, I take back what I said about the compiler producing an invalid location span. I think the compiler is producing a location span across multiple lines where the start's column is greater than the end's column. (So, a valid location span, but perhaps not one that dune is currently expecting.) Here's a smaller reproduction using OCaml 4.14.1. (* lib/tst.ml *)
type t = A | B
let f () () = function
| A -> ()
This displays:
Note how the location span is "lines 3-4, characters 14-11". Then running
|
Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: 4332e629-1de2-4ae2-a359-e47201ba5f30 -->
Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: 4332e629-1de2-4ae2-a359-e47201ba5f30 -->
The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes #7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: 9d20e3b2-2575-4910-b9a8-6722c6c6ccf3 -->
The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes #7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: 9d20e3b2-2575-4910-b9a8-6722c6c6ccf3 -->
The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes #7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com> <!-- ps-id: 9d20e3b2-2575-4910-b9a8-6722c6c6ccf3 -->
The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes #7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes ocaml#7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes ocaml#7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
* test: reproduce #7905 (#7949) Signed-off-by: Rudi Grinberg <me@rgrinberg.com> * fix: correctly print multi-line excerpts (#7950) The previous code would pretend that a multi-line excerpt was single-line whenever the stop character was outside the line. Fixes #7905 Signed-off-by: Rudi Grinberg <me@rgrinberg.com> --------- Signed-off-by: Rudi Grinberg <me@rgrinberg.com> Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
CHANGES: - Switch back to threaded console for all systems; fix unresponsive console on Windows (ocaml/dune#7906, @nojb) - Respect `-p` / `--only-packages` for `melange.emit` artifacts (ocaml/dune#7849, @anmonteiro) - Fix scanning of Coq installed files (@ejgallego, reported by @palmskog, ocaml/dune#7895 , fixes ocaml/dune#7893) - Fix RPC buffer corruption issues due to multi threading. This issue was only reproducible with large RPC payloads (ocaml/dune#7418) - Fix printing errors from excerpts whenever character offsets span multiple lines (ocaml/dune#7950, fixes ocaml/dune#7905, @rgrinberg)
I have the following stack trace:
And that the commit from which this error was triggered is: ocaml-flambda/flambda-backend@7ae1088
The text was updated successfully, but these errors were encountered: