[LLVMdev] 32 bit array size to malloc

Chris Lattner sabre at nondot.org
Wed Jun 11 23:07:26 PDT 2008


On Jun 11, 2008, at 2:38 PM, Ryan M. Lefever wrote:

> In the C documentation on linux, malloc is defined to take a size
> parameter of type size_t.  On my 64-bit linux machine, size_t turns  
> out
> to be a 64-bit type.  In LLVM, AllocationInst's require the array size
> passed to them to be a 32-bit type.  Is there a reason that LLVM's
> intermediate representation restricts the array size to be a 32-bit  
> type?

No, there is no good reason.  Like GEP, malloc and alloca should allow  
the size to be either i32 or i64.

-Chris



More information about the llvm-dev mailing list