<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Missing inexact FP exception on cast"
   href="https://bugs.llvm.org/show_bug.cgi?id=46810">46810</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing inexact FP exception on cast
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tydeman@tybor.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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}"</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>