[llvm-bugs] [Bug 46810] New: Missing inexact FP exception on cast
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 22 10:47:53 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: tydeman at tybor.com
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200722/5ff87698/attachment.html>
More information about the llvm-bugs
mailing list