<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Long double folding for powerpc target shows apparent underflow despite representable result"
   href="http://llvm.org/bugs/show_bug.cgi?id=20682">20682</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Long double folding for powerpc target shows apparent underflow despite representable result
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hstong@ca.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</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>