fesetenv() does not set the control word

Bug #583467 reported by Frederic Goualard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glibc (Ubuntu)
New
Undecided
Unassigned

Bug Description

Environment:
Ubuntu 8.04.4 LTS
gcc version 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
libc6 2.7-10ubuntu5

The following program should modify the FPU control word:
==============================================
#include <stdio.h>
#include <fenv.h>
#include <math.h>

int main(int argc, char *argv[])
{
  fenv_t fpuenv;
  fegetenv(&fpuenv);
  printf("Initial CW: %hx\n",fpuenv.__control_word);
  fpuenv.__control_word = (fpuenv.__control_word & 0xf0ff) | 0x0200;
  printf("Modified CW: %hx\n",fpuenv.__control_word);
  fesetenv(&fpuenv);
  fegetenv(&fpuenv);
  printf("Stored CW: %hx\n",fpuenv.__control_word);

  return 0;
}
==============================================
The output should be:
Initial CW: 37f
Modified CW: 27f
Stored CW: 27f

The output is:
Initial CW: 37f
Modified CW: 27f
Stored CW: 37f

which means that the FPU control word is not set by fesetenv().

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.