On Wednesday 06 of January 2010 09:36:01 Kovarththanan Rajaratnam wrote:
> @@ -2432,6 +2432,7 @@ mergefps (struct sortfile *files, size_t ntemps,
> size_t nfiles, saved.text = xrealloc (saved.text, savealloc);
> }
> saved.length = smallest->length;
> + assert(saved.text);
> memcpy (saved.text, smallest->text, saved.length);
> if (key)
> {
The patch does not solve anything as the assertion may disappear when not
compiling a debug build anyhow. Generally a proper fix is to ensure the
program logic never allows a NULL pointer as the memcpy() arg (even when
not debugging) ... but it has been IMO already done.
Can I somehow ask clang to give a probable counterexample for each such a
warning? Perhaps at least local only to the surrounding function? I think
it would help to prevent false alarms like this.
Kamil