[llvm-bugs] [Bug 46811] New: ARM isnormal(long double NaN) raises invalid

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 22 13:50:37 PDT 2020


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

            Bug ID: 46811
           Summary: ARM isnormal(long double NaN) raises invalid
           Product: clang
           Version: 10.0
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          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

/*
 * isnormal(long double NaN) raises invalid; it should not.
 */

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

int main(void){
  long double ldnan = NAN;
  long double ldinf = INFINITY;
  int ex;

  feclearexcept( FE_ALL_EXCEPT );
  if( isnormal(ldnan) ){
    (void)printf("bug 1: NAN is not normal\n");
  }
  ex = fetestexcept( FE_ALL_EXCEPT );
  if( 0 != ex ){
    (void)printf("bug 2: ex=%#x, FE_INVALID=%#x, ldnan=%Lg\n", ex, FE_INVALID,
ldnan);
  }

  feclearexcept( FE_ALL_EXCEPT );
  if( isnormal(ldinf) ){
    (void)printf("bug 3: INFINITY is not normal\n");
  }
  ex = fetestexcept( FE_ALL_EXCEPT );
  if( 0 != ex ){
    (void)printf("bug 4: ex=%#x, FE_INVALID=%#x, ldinf=%Lg\n", ex, FE_INVALID,
ldinf);
  }

  return 0;
}

I am not sure if this is a compiler built-in or part of the math library.

-- 
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/59960039/attachment.html>


More information about the llvm-bugs mailing list