[Bug target/96600] New: __builtin_modfl returns incorrect value

kretz at kde dot org gcc-bugzilla@gcc.gnu.org
Thu Aug 13 08:47:33 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96600

            Bug ID: 96600
           Summary: __builtin_modfl returns incorrect value
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kretz at kde dot org
  Target Milestone: ---
            Target: powerpc64le-*-*

Test case:

int e = 69;                                                                     
int main() {                                                                    
  long double a = -__builtin_ldexpl(                                            
     
1.9446689187403240306919491832695730985733566864714824565497322973045558e+00l,
e);                                                                             
  long double b = -__builtin_ldexpl(                                            
     
1.9446689187403240306919491832695730985733566864714824565497322973045558e+00l,
69);                                                                            
  long double tmp;                                                              
  long double aa = __builtin_modfl(a, &tmp);                                    
  long double bb = __builtin_modfl(b, &tmp);                                    
  if (aa != bb) {                                                               
    if (a == b)                                                                 
      return 2;                                                                 
    else                                                                        
      return 1;                                                                 
  }                                                                             
  return 0;                                                                     
}

This returns 2, i.e. the internal representation of a and b differ in such a
way that modf gets broken.

GCC was built with `--target=powerpc64le-linux-gnu --disable-nls
--without-headers --with-long-double-128`


More information about the Gcc-bugs mailing list