From 13fd7205fa891fbb1976778774ac8eb63d642186 Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Mon, 3 Nov 2014 09:51:44 +0000 Subject: [PATCH 1/1] [OCaml] Initialize local roots prior to raising. On 4.02, the OCaml unwinder otherwise gets confused and segfaults. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221142 91177308-0d34-0410-b5e6-96231b3b80d8 --- bindings/ocaml/llvm/llvm_ocaml.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index b43b3750734..d8682880033 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -1590,11 +1590,12 @@ CAMLprim value llvm_position_builder(value Pos, value B) { } /* llbuilder -> llbasicblock */ -CAMLprim LLVMBasicBlockRef llvm_insertion_block(value B) { +CAMLprim value llvm_insertion_block(value B) { + CAMLparam0(); LLVMBasicBlockRef InsertBlock = LLVMGetInsertBlock(Builder_val(B)); if (!InsertBlock) - raise_not_found(); - return InsertBlock; + caml_raise_not_found(); + CAMLreturn((value) InsertBlock); } /* llvalue -> string -> llbuilder -> unit */ -- 2.34.1