You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5074 Reporter:@ygrek Status: resolved (set by @xavierleroy on 2015-11-28T11:13:39Z) Resolution: suspended Priority: normal Severity: minor Version: 3.11.2 Category: ~DO NOT USE (was: OCaml general) Monitored by: mehdi @diml Camarade_Tux @hcarty@Chris00@alainfrisch
$ ./run
Fatal error: exception A.Error
Called from file "b.ml", line 2, characters 9-20
Called from file "b.ml", line 6, characters 2-6
Fatal error: exception A.Error
Raised at file "pervasives.ml", line 22, characters 22-33
Called from file "b.ml", line 5, characters 7-22
The backtrace for b.native is absolutely wrong.
Note that a.ml is compiled without -g option.
Additional information
Funny thing - if module A raises predefined exception instead of newly defined Error - everything is ok.
Minor note - no "Raised at" printed for b.byte
The text was updated successfully, but these errors were encountered:
Some progress has been made on this issue: now the native code says
Fatal error: exception A.Error
Raised by primitive operation at file "b.ml", line 2, characters 9-20
which is basically correct, considering that the "fail" function is probably inlined.
On the other hand, the bytecode result hasn't changed, it's still missing the "Raised by" line.
Yes, the inlining of A.fail produces a decent backtrace. The original problem is still there if a.ml is compiled with ocamlopt -inline 0, though.
I don't see any reasonable fix here. If one compiles with ocamlopt and without -g, it's to get the absolutely fastest implementation of exception raising, which doesn't reset the "last exception raised" global variable. Resetting that variable would defeat the purpose of getting the absolutely fastest implementation of exception raising.
More generally, mixing object files compiled with -g and without -g is not a scenario that I want us to spend implementation efforts on. Suspending this PR.
Original bug ID: 5074
Reporter: @ygrek
Status: resolved (set by @xavierleroy on 2015-11-28T11:13:39Z)
Resolution: suspended
Priority: normal
Severity: minor
Version: 3.11.2
Category: ~DO NOT USE (was: OCaml general)
Monitored by: mehdi @diml Camarade_Tux @hcarty @Chris00 @alainfrisch
Bug description
$ cat a.ml
exception Error
let fail () = raise Error
$ cat b.ml
let f () =
ignore (A.fail ())
let () =
(try failwith "oops" with _ -> ());
f ()
$ cat run
ocamlc -c a.ml -o a.cmo
ocamlc -c -g b.ml -o b.cmo
ocamlc -g a.cmo b.cmo -o b.byte
ocamlopt -c a.ml -o a.cmx
ocamlopt -c -g b.ml -o b.cmx
ocamlopt -g a.cmx b.cmx -o b.native
OCAMLRUNPARAM=b ./b.byte
OCAMLRUNPARAM=b ./b.native
$ ./run
Fatal error: exception A.Error
Called from file "b.ml", line 2, characters 9-20
Called from file "b.ml", line 6, characters 2-6
Fatal error: exception A.Error
Raised at file "pervasives.ml", line 22, characters 22-33
Called from file "b.ml", line 5, characters 7-22
The backtrace for b.native is absolutely wrong.
Note that a.ml is compiled without -g option.
Additional information
Funny thing - if module A raises predefined exception instead of newly defined Error - everything is ok.
Minor note - no "Raised at" printed for b.byte
The text was updated successfully, but these errors were encountered: