On 4/30/22 17:24, Bruno Haible wrote:
These dependencies save an 'errno = ENOMEM;' assignment in one or two places, but can cause integration problems; I am especially thinking at the use in GNU libintl and libasprintf.
Ah, I didn't know about the integration problems. I was worried about the case where malloc fails with some errno value other than ENOMEM and that errno value should be reflected to the user; but that's less important than getting integration right. (malloc can fail with EAGAIN on GNU/Linux and I assume other errno values are also possible.)
It would be worth to eliminate the false positive reports by GCC.
Yes, though the weird thing is I'm also using GCC 11.3.1 and am not getting the false positives.
We could use assume (result==resultbuf) for one part.
I am surprised GCC doesn't deduce that itself; it's part of that same weird thing.
If this happens only with unusual configuration settings I expect we don't need to worry about it. It's just a warning....
buf_malloced is NULL 99% of the time; here I prefer the code that saves a function call.
Good point; hadn't noticed that. I suppose this can also help make branch prediction more accurate.