Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#368 quadmath.h's expq function crashes at runtime

v1.0 (example)
closed-fixed
nobody
None
5
2014-03-12
2013-12-09
Sisyphus
No

Hi,

With recent MinGW64 ports of gcc, the attached program builds ok, but running it
results in a crash.
This happens with 4.6.3, 4.7.0, 4.7.3 and 4.8.1 (both 32-bit and 64-bit
versions); I haven't tried any other versions.

No such problem with mingw.org's gcc-4.7.0, nor with gcc-4.6.3 on Ubuntu.

(Note that building the attached demo program requires linking to libquadmath.a.)

Cheers,
Rob

1 Attachments

Discussion

  • Kai Tietz
    Kai Tietz
    2013-12-09

    Issue is in fesetenv AFAICS. Will investigate further what's wrong here.

    Thanks for reporting.
    Kai

     
  • Kai Tietz
    Kai Tietz
    2013-12-09

    • status: open --> open-accepted
     
  • Kai Tietz
    Kai Tietz
    2013-12-09

    Following patch should solve issue.

    Index: fesetenv.c

    --- fesetenv.c (Revision 6382)
    +++ fesetenv.c (Arbeitskopie)
    @@ -49,7 +49,9 @@ int fesetenv (const fenv_t * envp)
    {
    fenv_t env = envp;
    int _mxcsr;
    - _mxcsr = (env.unused0 << 16) | env.unused1; /
    mxcsr low and high /
    +
    asm ("fnstenv %0\n"
    + "stmxcsr %1" : "=m" (
    &env), "=m" (&_mxcsr));
    + /
    _mxcsr = ((int)envp->unused0 << 16) | (int)envp->unused1; // mxcs
    r low and high /
    env.unused0 = 0xffff;
    env.
    unused1 = 0xffff;

    asm volatile ("fldenv %0" : : "m" (env)
    @@ -56,7 +58,7 @@ int fesetenv (const fenv_t * envp)
    : "st", "st(1)", "st(2)", "st(3)", "st(4)",
    "st(5)", "st(6)", "st(7)");
    if (mingw_has_sse ())
    -
    asm volatile ("ldmxcsr %0" : : "m" (_mxcsr));
    +
    asm__ volatile ("ldmxcsr %0" : : "m" (
    &_mxcsr));
    }

    return 0;

     
  • Kai Tietz
    Kai Tietz
    2014-03-12

    • status: open-accepted --> closed-fixed
     
  • Kai Tietz
    Kai Tietz
    2014-03-12

    Issue got fix as patch was applied. Therefore close this bug