[Bug c/88576] -fno-math-errno causes GCC to consider that malloc does not set errno

aurelien at aurel32 dot net gcc-bugzilla@gcc.gnu.org
Sat Dec 22 19:43:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576

--- Comment #7 from Aurelien Jarno <aurelien at aurel32 dot net> ---
(In reply to Zack Weinberg from comment #5)
> The C standard doesn't say malloc _will_ set errno on failure, but it also

Well at least POSIX says:

Otherwise, it shall return a null pointer and set errno to indicate the error. 

> doesn't say it _won't_, and all library functions are allowed to clobber the
> value of errno unless it is specifically documented that they won't (N1570
> 7.5 [Errors], para 3, last sentence).

I fully agree with that.


More information about the Gcc-bugs mailing list