Issue 162837
Summary complex divide: zero / infinity raises FE_INVALID
Labels new issue
Assignees
Reporter tydeman
    This fails:

#include <assert.h>
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <float.h>
#include <fenv.h>
#include <complex.h>
#include <math.h>	/* glibc 2.41-11 */

#pragma STDC FENV_ACCESS ON
#pragma STDC FP_CONTRACT OFF
#pragma STDC FENV_ROUND FE_TONEAREST
#pragma STDC FENV_DEC_ROUND FE_DEC_TONEAREST
#pragma STDC CX_LIMITED_RANGE OFF

int main(void){

 if(1){
    float complex fc29;
    int flags;
    errno = 0;
 feclearexcept(FE_ALL_EXCEPT);
    fc29 = 0.f / CMPLXF(0.f,INFINITY); /* 0 / infinity */
    flags = fetestexcept(FE_ALL_EXCEPT);
    assert( 0 == errno );
    assert( 0.f == crealf(fc29) );
    assert( 0.f == cimagf(fc29) );
 assert( !(FE_INVALID & flags) );	/* fails here */
  }
  return 0;
}

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to