[petsc-dev] clang --analyze messages on PETSc

Jed Brown jed at jedbrown.org
Wed Apr 15 13:10:42 CDT 2015


Barry Smith <bsmith at mcs.anl.gov> writes:
>    How to handle MallocK() where say the second item has length zero?

You mean in optimized mode?  (Debug mode can and should call malloc(0)
every time.)  I think either NULL or the same address is fine.  We don't
have sentinels in optimized mode anyway.

>    Do we return a NULL for that item (as current code), the same
>    address as the previous object (means if the user writes to that
>    location they have bugs that are difficult to detect) or the
>    special value that malloc(0) returns (how to get that special
>    value? We can't call malloc(0) each time because there is no place
>    to call free() on them with the FreeK().

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150415/598057db/attachment.sig>


More information about the petsc-dev mailing list