This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/16198] New: fegetenv() clears exception mask on x86_64


https://sourceware.org/bugzilla/show_bug.cgi?id=16198

            Bug ID: 16198
           Summary: fegetenv() clears exception mask on x86_64
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: fxcoudert at gcc dot gnu.org

Take the following code:

#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);
}


I expect it to output "0 1 1 1", and it does on i386-linux. But on
x86_64-linux, it outputs "0 1 0 1", showing that the call to fegetenv() clears
the exception mask. I don't see this behavior documented, and I don't think
it's allowed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]