[PATCH] D136537: [llvm-ocaml] Assume pointers are at least 2-bit aligned

Josh Berdine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 18 13:56:28 PST 2023


jberdine added a comment.

Argh, I made these comments some time ago and failed to submit them.



================
Comment at: llvm/bindings/ocaml/llvm/llvm_ocaml.c:540
   unsigned Length = LLVMCountParamTypes(Type_val(FunTy));
   LLVMTypeRef *Temp = malloc(sizeof(LLVMTypeRef) * Length);
   LLVMGetParamTypes(Type_val(FunTy), Temp);
----------------
Here and in a number of other cases the result of malloc is not checked for NULL.


================
Comment at: llvm/bindings/ocaml/llvm/llvm_ocaml.c:602
   unsigned Length = LLVMCountStructElementTypes(Type_val(StructTy));
   LLVMTypeRef *Temp = alloc_temp(sizeof(LLVMTypeRef) * Length);
   LLVMGetStructElementTypes(Type_val(StructTy), Temp);
----------------
jberdine wrote:
> `alloc_temp` expects an ocaml block, not a size



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136537/new/

https://reviews.llvm.org/D136537



More information about the llvm-commits mailing list