[Bug c/88576] -fno-math-errno causes GCC to consider that malloc does not set errno
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Dec 22 18:47:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88576
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Aurelien Jarno from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > IIRC malloc setting errno also non standard.
>
> According to POSIX:
>
> The malloc() function shall fail if:
>
> [ENOMEM]
> [CX] [Option Start] Insufficient storage space is available. [Option
> End]
>
> In that case malloc returns a NULL pointer. However even after adding a
> check for the return value, GCC still optimizes-out saving and restoring
> errno.
POSIX says one thing but C99 says another thing.
More information about the Gcc-bugs
mailing list