[PATCH] D19085: [clang-analyzer] fix warnings emitted on compiler-rt code base

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 18:12:09 PDT 2016


george.burgess.iv added a subscriber: george.burgess.iv.
george.burgess.iv added a comment.

Hi, and thanks for the patch!

It looks like the static analyzer might think we're allocating an array of `emutls_address_array` here. If we want to make it be quiet, we can probably just swap to using `sizeof(emutls_address_array)`, but I'm not sure if that's better than `sizeof(void*)`, given that the former makes it look like we were actually trying to allocate an array of arrays (IMO).

> but shouldn't the alloc return value be casted for correctness ?


C allows implicit conversions from `void *` to other pointer types, so I don't think an explicit cast here would cause the code to be more/less correct.

Either way, if this patch lands (I don't have an opinion on whether or not it should), please also add a cast to the malloc at line 53, so we have a consistent style within emutls.c. :)


http://reviews.llvm.org/D19085





More information about the llvm-commits mailing list