Issue 166866
Summary Initialization of union not raise expected FPU flag
Labels new issue
Assignees
Reporter tydeman
    #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){
 feclearexcept(FE_ALL_EXCEPT);
  errno = 0;
  if(1){
    union { float f32; int i; } uf0 = { 0.F / 0.F };
    int flags;
    flags = fetestexcept(FE_ALL_EXCEPT);
    assert( 0 == errno );
    assert( isnan( uf0.f32 ) );
    assert( 0 != flags );	/* fails here */
    assert( FE_INVALID == flags );
  }
  return 0;
}

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

Reply via email to