https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64101
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|NEW |RESOLVED --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Recent glibc documents These functions do not set errno. (and in fact they do not). GCC does not elide the erf() call with -O0 which is how you can verify your erf implementation sets or does not set errno, at -O1 GCC elides the erf call as the result is unused. According to Joseph glibcs behavior is correct and so is then GCCs.