<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 - __builtin_constant_p returns 1 instead of 0 when there is a side effect"
   href="https://bugs.llvm.org/show_bug.cgi?id=43557">43557</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__builtin_constant_p returns 1 instead of 0 when there is a side effect
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </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>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vincent-llvm@vinc17.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If the value of __builtin_constant_p is constant, 1 is returned even when there
is a side effect. This is a regression in Clang 9.

Testcase:

#include <stdio.h>

int main (void)
{
  int c, i = 0;
  c = __builtin_constant_p ((i++, 0));
  printf ("%d %d\n", c, i);
  return 0;
}

which outputs "1 0" instead of "0 0" with:

clang version 9.0.0-1 (tags/RELEASE_900/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

(Debian package clang-9 1:9-1).

Note: This makes one test of GNU MPFR fail (tcmp_ui) and can affect code using
MPFR, when this user code is built with Clang 9.</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>