[LLVMbugs] [Bug 2682] New: llvm-gcc fails to find that an argument to __builtin_prefetch is a constant

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Aug 15 06:16:43 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2682

           Summary: llvm-gcc fails to find that an argument to
                    __builtin_prefetch is a constant
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: rafael.espindola at gmail.com
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu


the function

-------------------------------------------
void prefetch(const char *x, int hint) {
  if (__builtin_constant_p(hint)) {
    __builtin_prefetch(x, 0, hint);
  }
}
------------------------------------------

is a valid. Except in the case it is inlined, it is equivalent to

-------------------------------------------
void prefetch(const char *x, int hint) {
  if (0) {
    __builtin_prefetch(x, 0, hint);
  }
}
------------------------------------------

llvm-gcc fails to compile it:

testcase.i: In function 'prefetch':
testcase.i:1: error: third argument to '__builtin_prefetch' must be a constant

the version with "if (0)" compiles correctly.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list