[llvm] f7be9db - [OCaml] Fix buildbot failure in OCaml tests

Vaivaswatha Nagaraj via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 16 23:01:53 PDT 2021


Author: Vaivaswatha Nagaraj
Date: 2021-03-17T11:29:55+05:30
New Revision: f7be9db6220cb39f0eaa12d2af3abedf0d86c303

URL: https://github.com/llvm/llvm-project/commit/f7be9db6220cb39f0eaa12d2af3abedf0d86c303
DIFF: https://github.com/llvm/llvm-project/commit/f7be9db6220cb39f0eaa12d2af3abedf0d86c303.diff

LOG: [OCaml] Fix buildbot failure in OCaml tests

The commit 506df1bbfd16233134a6ddea96ed2d49077840fd introduced
a call to `caml_alloc_initialized_string` which seems to be
unavailable on older OCaml versions. So I'm now switching to
using `caml_alloc_string` and using a `memcpy` after that, as
is done in the rest of the file.

Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/16/builds/7919

Added: 
    

Modified: 
    llvm/bindings/ocaml/llvm/llvm_ocaml.c

Removed: 
    


################################################################################
diff  --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
index 8994f524a1a8..65e8bfc7b6c8 100644
--- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c
@@ -48,7 +48,8 @@ CAMLprim value cstr_to_string(const unsigned char *Str, unsigned Len) {
   CAMLparam0();
   CAMLlocal1(String);
   if (Str) {
-    String = caml_alloc_initialized_string(Len, Str);
+    String = caml_alloc_string(Len);
+    memcpy(String_val(Str), Str, Len);
   } else {
     String = caml_alloc_string(0);
   }


        


More information about the llvm-commits mailing list