[cfe-dev] [ MallocSizeofChecker ] - False positive about MallocSizeofChecker
via cfe-dev
cfe-dev at lists.llvm.org
Mon Sep 4 19:01:16 PDT 2017
>From this point of view, the warning should be emitted, after all, the use of malloc and sizeof is not standardized.
Thanks,
Henry.
<quote author='Raoul Wols via cfe-dev'>
On Mon, Sep 04, 2017 at 03:23:10AM +0000, Wong Henry via cfe-dev wrote:
> warning: Result of 'malloc' is converted to a pointer of type
> 'unsigned int', which is incompatible with sizeof operand type 'int'
> ptr = (unsigned int*)malloc(sizeof(int) * 12);
I think it works perfectly correct here. There is a reason why the
common idiom is to use sizeof(*ptr) in this case.
Joerg
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
</quote>
Quoted from:
http://clang-developers.42468.n3.nabble.com/MallocSizeofChecker-False-positive-about-MallocSizeofChecker-tp4058067p4058069.html
_____________________________________
Sent from http://clang-developers.42468.n3.nabble.com
More information about the cfe-dev
mailing list