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

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> 
2012-08-09 13:31:22 UTC ---
FYI this also turns glibc's  __ieee754_fmodf into an endless loop:

>From sysdeps/ieee754/flt-32/e_fmodf.c:

float
__ieee754_fmodf (float x, float y)
{
        int32_t n,hx,hy,hz,ix,iy,sx,i;

        GET_FLOAT_WORD(hx,x);
        GET_FLOAT_WORD(hy,y);
        sx = hx&0x80000000;             /* sign of x */
        hx ^=sx;                /* |x| */
        hy &= 0x7fffffff;       /* |y| */

    /* purge off exception values */
        if(hy==0||(hx>=0x7f800000)||            /* y=0,or x not finite */
           (hy>0x7f800000))                     /* or y is NaN */
            return (x*y)/(x*y);
        if(hx<hy) return x;                     /* |x|<|y| return x */
        if(hx==hy)
            return Zero[(u_int32_t)sx>>31];     /* |x|=|y| return x*0*/

    /* determine ix = ilogb(x) */
        if(hx<0x00800000) {     /* subnormal x */
            for (ix = -126,i=(hx<<8); i>0; i<<=1) ix -=1;
        } //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ endless loop

Disassembly of section .text:

0000000000000000 <__fmodf_finite>:
   0:   66 0f 7e c0             movd   %xmm0,%eax
   4:   89 c7                   mov    %eax,%edi
   6:   81 e7 00 00 00 80       and    $0x80000000,%edi
   c:   66 41 0f 7e c8          movd   %xmm1,%r8d
  11:   31 f8                   xor    %edi,%eax
  13:   44 89 c6                mov    %r8d,%esi
  16:   81 e6 ff ff ff 7f       and    $0x7fffffff,%esi
  1c:   3d ff ff 7f 7f          cmp    $0x7f7fffff,%eax
  21:   7f 2d                   jg     50 <__fmodf_finite+0x50>
  23:   85 f6                   test   %esi,%esi
  25:   74 29                   je     50 <__fmodf_finite+0x50>
  27:   81 fe 00 00 80 7f       cmp    $0x7f800000,%esi
  2d:   7f 21                   jg     50 <__fmodf_finite+0x50>
  2f:   39 f0                   cmp    %esi,%eax
  31:   7c 6d                   jl     a0 <__fmodf_finite+0xa0>
  33:   74 73                   je     a8 <__fmodf_finite+0xa8>
  35:   3d ff ff 7f 00          cmp    $0x7fffff,%eax
  3a:   89 c2                   mov    %eax,%edx
  3c:   7f 7a                   jg     b8 <__fmodf_finite+0xb8>
  3e:   c1 e2 08                shl    $0x8,%edx
  41:   85 d2                   test   %edx,%edx
  43:   0f 8e 2a 01 00 00       jle    173 <__fmodf_finite+0x173>
  49:   eb fe                   jmp    49 <__fmodf_finite+0x49>

Reply via email to