mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-26 06:22:56 +02:00
2acdd67db2
See http://caml.inria.fr/mantis/view.php?id=4166 If we call only external functions from a module, then its 'let _' bindings don't get executed, which means that the exceptions don't get registered for use in the C code. This in turn causes llvm_raise to call raise_with_arg() with a NULL pointer and cause a segmentation fault. The workaround is to declare all 'external' functions as 'val' in these .mli files. Also added a separate testcase (the testcase must call only external functions for the bug to occur). llvm-svn: 122497
17 lines
596 B
OCaml
17 lines
596 B
OCaml
(* RUN: %ocamlopt -warn-error A llvm.cmxa llvm_bitreader.cmxa llvm_executionengine.cmxa %s -o %t
|
|
* RUN: %t </dev/null
|
|
*)
|
|
let context = Llvm.global_context ()
|
|
(* this used to crash, we must not use 'external' in .mli files, but 'val' if we
|
|
* want the let _ bindings executed, see http://caml.inria.fr/mantis/view.php?id=4166 *)
|
|
let _ =
|
|
try
|
|
ignore (Llvm_bitreader.get_module context (Llvm.MemoryBuffer.of_stdin ()))
|
|
with
|
|
Llvm_bitreader.Error _ -> ();;
|
|
let _ =
|
|
try
|
|
ignore (Llvm.MemoryBuffer.of_file "/path/to/nonexistent/file")
|
|
with
|
|
Llvm.IoError _ -> ();;
|