[PATCH] D148958: Size and element numbers are often swapped when calling calloc
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 21 15:24:23 PDT 2023
MaskRay added a comment.
In D148958#4288782 <https://reviews.llvm.org/D148958#4288782>, @vzakhari wrote:
> In D148958#4288728 <https://reviews.llvm.org/D148958#4288728>, @MaskRay wrote:
>
>> This is an unnecessary change. The arguments are interchangeable.
>> In musl, there are at least 2 places where the parameters could be swapped, but I not unsure this warrants a commit.
>
> Isn't the memory alignment dependent on the element size in general? In this case it might be a potential correctness issue fix.
> I understand that many `calloc` implementations may align them to works-for-all boundary, but it may still worth be "fixing".
No. The two arguments are interchangeable. Neither argument affects the alignment. Use `aligned_alloc` to control alignment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148958/new/
https://reviews.llvm.org/D148958
More information about the cfe-commits
mailing list