http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51007

--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 
2011-11-07 11:29:39 UTC ---
The bug is not in the I/O routine, it can be reproduce by this simple
self-contained testcase (which doesn't need libquadmath).

#include <stdint.h>

typedef union
{
  __float128 value;

  struct
  {
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
    unsigned negative:1;
    unsigned exponent:15;
    uint64_t mant_high:48;
    uint64_t mant_low:64;
#else
    uint64_t mant_low:64;
    uint64_t mant_high:48;
    unsigned exponent:15;
    unsigned negative:1;
#endif
  } ieee;
} ieee854_float128;

int main (void)
{
  ieee854_float128 d;
  d.value = (__float128) 3.14;
  __builtin_printf ("%u\n", (unsigned) d.ieee.exponent);
}

On darwin, this program consistently outputs 16384. When cross-compiled to
mingw, and run on Windows XP, it consistently outputs 6448. When the same
executable is run under Wine on darwin, it outputs inconsistent, wrong values
(the last few invocations here show: 4755, 12947, 21139).

Reply via email to