Floating point fegetenv()清除x86_64-linux上的异常掩码

Floating point fegetenv()清除x86_64-linux上的异常掩码,floating-point,c99,glibc,floating-point-exceptions,fenv,Floating Point,C99,Glibc,Floating Point Exceptions,Fenv,让我们看一下下面的节目: #include <stdio.h> #include <fenv.h> int main (void) { fenv_t e; printf ("%d\n", fegetexcept () & FE_INVALID ? 1 : 0); feenableexcept (FE_INVALID); printf ("%d\n", fegetexcept () & FE_INVALID ? 1 : 0); feg

让我们看一下下面的节目:

#include <stdio.h>
#include <fenv.h>

int main (void)
{
  fenv_t e;

  printf ("%d\n", fegetexcept () & FE_INVALID ? 1 : 0);
  feenableexcept (FE_INVALID);
  printf ("%d\n", fegetexcept () & FE_INVALID ? 1 : 0);
  fegetenv (&e);
  printf ("%d\n", fegetexcept () & FE_INVALID ? 1 : 0);
  fesetenv (&e);
  printf ("%d\n", fegetexcept () & FE_INVALID ? 1 : 0);
}
#包括
#包括
内部主(空)
{
芬维特;
printf(“%d\n”,fegetexcept()&feu无效?1:0);
feenableexcept(FE_无效);
printf(“%d\n”,fegetexcept()&feu无效?1:0);
fegetenv&e;
printf(“%d\n”,fegetexcept()&feu无效?1:0);
fesetenv&e;
printf(“%d\n”,fegetexcept()&feu无效?1:0);
}
我希望它输出“0 1”:即,一旦我启用了
feu INVALID
异常,使用相同环境调用
fegetenv
fesetenv
,就不应该修改它

这在i386 linux上可以正常工作,但在x86_64-linux(64位模式)上,我得到了“0 1 0 1”。也就是说,调用
fegetenv
将清除异常掩码

我看不到任何地方有记录,甚至C99下也没有允许的行为。我可以在glibc-2.5和glib-2.13下确认

有人能在最近的glibc上测试它吗我认为这是一个bug,对吗?

好吧,我已经在glibc bug数据库中找到了,这已经得到了一位开发人员的确认。我想这足以证明它确实是glibc中的一个bug,我已经在glibc bug数据库中找到了,这已经被一个开发人员确认了。我想这足以证明它确实是glibc中的一个bug