Hi,
Yes, I know getPointerToGlobal is deprecated, but it's the only
interface we have in the OCaml world. So this is an investigation to
see if the newer interfaces, specifically getGlobalValueAddress,
suffers from the same problems. The first bug is fun; if you have emit
two anonymous functions, and pass gptg their function objects to get
the value via Ctypes, the second gtpg grabs the value of the first
function:
diff --git a/test/Bindings/OCaml/executionengine.ml
b/test/Bindings/OCaml/executionengine.ml
index 893f988..6e4a5ad 100644
--- a/test/Bindings/OCaml/executionengine.ml
+++ b/test/Bindings/OCaml/executionengine.ml
@@ -42,6 +42,22 @@ let define_plus m =
ignore (build_ret add b);
fn
+let define_anon1 m =
+ let fn = define_function "" (function_type i32_type [| i32_type;
+ i32_type |]) m in
+ let b = builder_at_end (global_context ()) (entry_block fn) in
+ let add = build_add (param fn 0) (param fn 1) "sum" b in
+ ignore (build_ret add b);
+ fn