)]}'
{
  "commit": "d5274305abebaad50564a0778f01d2d6556ad2ec",
  "tree": "bff87cdda0478780de68e95d66aac1bc7a013c6b",
  "parents": [
    "5e7a3a990407cbd0d51c226d13dcff724e2d1958"
  ],
  "author": {
    "name": "Liu Hao",
    "email": "lh_mouse@126.com",
    "time": "Mon Feb 25 22:35:43 2019 +0800"
  },
  "committer": {
    "name": "Liu Hao",
    "email": "lh_mouse@126.com",
    "time": "Fri Mar 08 16:26:38 2019 +0800"
  },
  "message": "crt/misc/fesetenv.c: Do not clobber `env` with `FNSTENV`\n\n... and do not involve `STMXCSR` unless SSE is supported.\n\nThis can be shown by the following program:\n\n```\n\nint main(void)\n{\n    /* Compute 1.0/3.0 in default FPU mode */\n    volatile float somefloat \u003d 1.0;\n    somefloat /\u003d 3.0;\n\n    /* Output it in float and hex formats */\n    printf(\"%.9g\\thex: %x\\n\", somefloat, *(int *)\u0026somefloat);\n\n    fenv_t a, b;\n\n    fegetenv(\u0026a); /* Save fpu env */\n\n    fesetround(FE_TOWARDZERO);  /* Set round mode */\n\n    fesetenv(\u0026a); /* Restore fpu env (round mode must also be restored) */\n\n    fegetenv(\u0026b); /* Get current fpu env */\n\n    /* Compute 1.0/3.0 after changing and restoring fpu env */\n    volatile float somefloat2 \u003d 1.0;\n    somefloat2 /\u003d 3.0;\n\n    /* Output it in float and hex formats */\n    printf(\"%.9g\\thex: %x\\n\", somefloat2, *(int *)\u0026somefloat2);\n\n    /* Output FPU control words */\n    printf (\"FPU control words: %x, %x\\n\", a.__control_word, b.__control_word);\n\n    return 0;\n}\n```\n\nOn Linux, compiling and running this program gives the following result:\n\n```\nlh_mouse@lhmouse-ideapad ~/Desktop $ gcc -v 2\u003e\u00261 | egrep \u0027^Target:\u0027\nTarget: x86_64-linux-gnu\nlh_mouse@lhmouse-ideapad ~/Desktop $ gcc test.c -lm -m32 \u0026\u0026 ./a.out\n0.333333343\thex: 3eaaaaab\n0.333333343\thex: 3eaaaaab\nFPU control words: 37f, 37f\nlh_mouse@lhmouse-ideapad ~/Desktop $ gcc test.c -lm -m64 \u0026\u0026 ./a.out\n0.333333343\thex: 3eaaaaab\n0.333333343\thex: 3eaaaaab\nFPU control words: 37f, 37f\n```\n\n, while before this commit, our CRT produced wrong results because the FPU\ncontrol word would be clobbered:\n\n```\nE:\\Desktop\u003egcc test.c \u0026\u0026 a.exe\n0.333333343     hex: 3eaaaaab\n0.333333313     hex: 3eaaaaaa\nFPU control words: 37f, f7f\n```\n\nReference: https://sourceforge.net/p/mingw-w64/mailman/message/36596484/\nSigned-off-by: Liu Hao \u003clh_mouse@126.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "f998017b4fcaef0d6feb9afe71e89f24a9c449f4",
      "old_mode": 33188,
      "old_path": "mingw-w64-crt/misc/fesetenv.c",
      "new_id": "9b44fab6465c23c598d78eac3e6ca353fc167d95",
      "new_mode": 33188,
      "new_path": "mingw-w64-crt/misc/fesetenv.c"
    }
  ]
}
