[LLVMbugs] [Bug 20682] New: Long double folding for powerpc target shows apparent underflow despite representable result

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 15 15:44:34 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20682

            Bug ID: 20682
           Summary: Long double folding for powerpc target shows apparent
                    underflow despite representable result
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

PPC double-double has variable precision and it is generally possible to add
extremely small numbers (e.g., double denorm_min()) to a value which is exactly
representable in a single double without underflow.

### SOURCE:
$ cat ppcLdbl.cc 
// fails if A and B differ by at least LDBL_MANT_DIG (106),
// a fixed value not representative of the format
#define A   968
#define B  1074

#define LDBL_VAL2( X )  0x1p- ## X ## L;
#define LDBL_VAL( X )   LDBL_VAL2( X )

constexpr long double ld0 = LDBL_VAL( A );
constexpr long double ld = ld0 + LDBL_VAL( B );
typedef char chk[ld == ld0 ? -1 : 1];


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -triple powerpc64-unknown-linux-gnu -std=c++11 -x c++ ppcLdbl.cc
ppcLdbl.cc:11:18: error: 'chk' declared as an array with a negative size
typedef char chk[ld == ld0 ? -1 : 1];
                 ^~~~~~~~~~~~~~~~~~
1 error generated.


### EXPECTED OUTPUT:
No errors.


### COMPILER VERSION INFO:
$ clang -target powerpc64-unknown-linux-gnu -v
clang version 3.5.0 (trunk 214060)
Target: powerpc64-unknown-linux-gnu
Thread model: posix

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


More information about the llvm-bugs mailing list