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

            Bug ID: 43557
           Summary: __builtin_constant_p returns 1 instead of 0 when there
                    is a side effect
           Product: new-bugs
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedb...@nondot.org
          Reporter: vincent-l...@vinc17.net
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to