https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64101
--- Comment #2 from niva at niisi dot msk.ru --- Please explain why erf is marked as 'const' and does not use ATTR_MATHFN_FPROUNDING_ERRNO? ISO C does not say that erf may not set errno. And POSIX directly requires that erf, erff, erfl set errno=ERANGE in case of underflow. Here is another example: #include <stdio.h> #include <errno.h> #include <math.h> extern double res; int main () { errno = 0; res = erf (-1.2553634935946022721708238314E-308); printf ("errno=%d, res=%g\n", errno, res); return 0; } As a result of mips64-none-elf-gcc -O1 -S tst2_erf.c -o tst2_erf.s the following code is generated: main: ... addiu $sp,$sp,-40 sd $31,32($sp) sw $0,%gp_rel(errno)($28) jal erf ldc1 $f12,%gp_rel($LC0)($28) sdc1 $f0,%gp_rel(res)($28) lui $4,%hi($LC1) # printf arg 0: format line addiu $4,$4,%lo($LC1) dmfc1 $6,$f0 # printf arg 2: res jal printf move $5,$0 #! printf arg 1: zero (must be errno) move $2,$0 ld $31,32($sp) j $31 addiu $sp,$sp,40 Zero ($0) is passed to printf instead of errno. If -fno-builtin-printf is used the compiler generates lw $5,%gp_rel(errno)($28) instead of move $5,$0 in the delay slot after "jal printf". В Птн, 28/11/2014 в 13:24 +0000, rguenth at gcc dot gnu.org пишет: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64101 > > Richard Biener <rguenth at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Target| |x86_64-*-*, mips64-none-elf > Status|UNCONFIRMED |NEW > Last reconfirmed| |2014-11-28 > Ever confirmed|0 |1 > > --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- > I think the issue is that you don't use the result of erf() and the function > is marked as 'const' - thus does not use ATTR_MATHFN_FPROUNDING_ERRNO. > If you make 'res' global then it will work. >