[PATCH] D19085: [clang-analyzer] fix warnings emitted on compiler-rt code base
Apelete Seketeli via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 17:01:23 PDT 2016
apelete created this revision.
apelete added a subscriber: llvm-commits.
The following warnings were reported while running clang analyzer on Compiler-RT:
Unix API: allocator sizeof operand mismatch, on file:
- lib/builtins/emutls.c.
This patch does not suppress the warning in fact, since sizeof operand
still mismatch, but shouldn't the alloc return value be casted for
correctness ?
Fixes T123 (please note that first revision was sent only to
llvm-commits mailing list, not reviewed yet).
Signed-off-by: Apelete Seketeli <apelete at seketeli.net>
http://reviews.llvm.org/D19085
Files:
lib/builtins/emutls.c
Index: lib/builtins/emutls.c
===================================================================
--- lib/builtins/emutls.c
+++ lib/builtins/emutls.c
@@ -164,12 +164,12 @@
emutls_address_array* array = pthread_getspecific(emutls_pthread_key);
if (array == NULL) {
uintptr_t new_size = emutls_new_data_array_size(index);
- array = calloc(new_size + 1, sizeof(void*));
+ array = (emutls_address_array *) calloc(new_size + 1, sizeof(void*));
emutls_check_array_set_size(array, new_size);
} else if (index > array->size) {
uintptr_t orig_size = array->size;
uintptr_t new_size = emutls_new_data_array_size(index);
- array = realloc(array, (new_size + 1) * sizeof(void*));
+ array = (emutls_address_array *) realloc(array, (new_size + 1) * sizeof(void*));
if (array)
memset(array->data + orig_size, 0,
(new_size - orig_size) * sizeof(void*));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19085.53645.patch
Type: text/x-patch
Size: 958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160414/323cc415/attachment.bin>
More information about the llvm-commits
mailing list