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

zackw at panix dot com gcc-bugzilla@gcc.gnu.org
Sat Dec 22 20:22:00 GMT 2018


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

--- Comment #9 from Zack Weinberg <zackw at panix dot com> ---
... whoops, hit send a little too early.  AFAICT, the relevant code is
call_may_clobber_ref_p_1 in tree-ssa-alias.c; I would say that the uses of
flag_errno_math under the cases BUILT_IN_MALLOC, ALIGNED_ALLOC, CALLOC, STRDUP,
STRNDUP, POSIX_MEMALIGN, REALLOC in that function are all wrong, and GCC should
unconditionally assume errno may be clobbered by those builtins.  If this
behavior is felt to be valuable, it should get its own -f switch.

(The uses of flag_errno_math under BUILT_IN_GAMMA*, LGAMMA*, and REMQUO* are
appropriate, though, as those _are_ math functions.)


More information about the Gcc-bugs mailing list