https://bugs.llvm.org/show_bug.cgi?id=46810

            Bug ID: 46810
           Summary: Missing inexact FP exception on cast
           Product: clang
           Version: 10.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

This code shows that the cast operator is not raising the floating point
inexact exception (perhaps because the cast was done at translation time).  I
am using as many options as I can find to get IEEE-754 and C standard
conformance.  This is on ARM CPU.

/*
 * Missing inexact FP exception on cast.
 */

#include <float.h>
#include <fenv.h>
#include <stdio.h>

int main(void){
  int ex;

  feclearexcept( FE_ALL_EXCEPT );
  if( 0.1F == (float)0.1 ){     /* inexact on cast */
    (void)printf("equal\n");
  }else{
    (void)printf("not equal\n");
  }
  ex = fetestexcept( FE_ALL_EXCEPT );
  if( FE_INEXACT != ex ){
    (void)printf("bug: ex = %#x, FE_INEXACT=%#x\n", ex, FE_INEXACT);
  }
  (void)printf("FLT_EVAL_METHOD=%i\n", FLT_EVAL_METHOD);

  return 0;
}

# flags for compiler
export CFLAGS="-H -std=c2x -pedantic -pedantic-errors -O0 -m64 -march=armv8-a
-mcpu=cortex-a72 \
 -ffp-model=strict \
 -ffp-exception-behavior=strict \
 -fhonor-infinities \
 -fhonor-nans \
 -fmath-errno \
 -fno-associative-math \
 -fno-builtin \
 -fno-finite-math-only \
 -fno-reciprocal-math \
 -fno-unsafe-math-optimizations \
 -frounding-math \
 -fsigned-zeros \
 -fstrict-float-cast-overflow \
 -ftrapping-math \
 -Xclang -disable-llvm-optzns \
 ${INCS}"

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to