<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 - clang hangs when compiling a code sample"
   href="https://bugs.llvm.org/show_bug.cgi?id=42148">42148</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang hangs when compiling a code sample
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

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

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>zhonghao@pku.org.cn
          </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>My command line is clang++ -O3, its version is 9.0.0

The code line is as follows:

typedef unsigned __int128 u128_t;
typedef __float128 f128_t;

typedef union
{
 f128_t f;
 u128_t i;
} union128_t;

int test(volatile f128_t *start_X_ptr, volatile f128_t *start_Y_ptr)
{
 for (unsigned iter_count = 1; iter_count <= 2; iter_count++)
 {
 union128_t read_valX = { .f = *start_X_ptr };
 union128_t read_valY = { .f = *start_Y_ptr };

 u128_t expected_val = ((iter_count - 1) * read_valY.i);
 if (read_valX.i != expected_val)
 {
 return -1;
 }

 union128_t write_valX = { .i = (iter_count * (read_valX.i + 1)) };
 union128_t write_valY = { .i = (read_valX.i + 1) };

 *start_X_ptr = write_valX.f;
 *start_Y_ptr = write_valY.f;
 }
 return 0;
}

clang hangs when it compiles the code. It consumes a lot of CPU time.</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>