[llvm-bugs] [Bug 46802] New: ARM long double arithmetic done wrong

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 21 23:08:21 PDT 2020


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

            Bug ID: 46802
           Summary: ARM long double arithmetic done wrong
           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

/*
 * Signed zero long double bug.  All output should be +inf.
 */

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

static long double ld_P0 = +0.L;
static long double ld_M0 = -0.L;
static long double ld_pone = +1.L;

int main(void){
  long double ld23;
  int rnd_rc;

  (void)printf("ld_M0=%Lg, ld_pone=%Lg\n", ld_M0, ld_pone);

  ld23 = ld_P0 + ld_P0*ld_pone;
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  ld23 = -ld_M0 - ld_M0*ld_pone;
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  rnd_rc = fesetround( FE_DOWNWARD );
  ld23 = ld_P0 + ld_P0*ld_pone;
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  ld23 = -ld_M0 - ld_M0*ld_pone;        /* bug */
  (void)printf("1/ld23=%Lg\n", 1.L/ld23);

  return 0;
}

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


More information about the llvm-bugs mailing list