[LLVMbugs] [Bug 65] New: C front-end miscompiles the builtin_expect intrinsic!

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Tue Oct 28 23:06:48 PST 2003


           Summary: C front-end miscompiles the builtin_expect intrinsic!
           Product: tools
           Version: 1.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: llvm-gcc
        AssignedTo: sabre at nondot.org
        ReportedBy: sabre at nondot.org

The C/C++ frontends are miscompiling the GCC extension __builtin_expect.  For
example, this testcase prints FAILURE instead of pass:

#include <stdio.h>
int main() {
  int A = 1, B = 0;
  if (__builtin_expect(A < B, 1))

Currently it is always expanding the "expected" value, instead of expanding the
expression, thus returning the wrong value if the expectation happens to be wrong.

This is either causing or contributing to PR61.

A significant amount of GNU headers use this (including libstdc++), so this is a
severe problem.

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

More information about the llvm-bugs mailing list