[llvm-bugs] [Bug 37082] New: [Clang] Wrong code for re-definition of builtin function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 10 21:37:14 PDT 2018


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

            Bug ID: 37082
           Summary: [Clang] Wrong code for re-definition of builtin
                    function
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yangyibiao at nju.edu.cn
                CC: llvm-bugs at lists.llvm.org

$ clang -v

$ cat small.c
#include <stdio.h> // #1
static int strcmp(){return 20;} // #2
#define strcmp __builtin_strcmp // #3
int main()
{
  int ret = strcmp("a","b");
  printf("%d\n", ret);
  return 0;
}

$ clang small.c; ./a.out
20

$ gcc small.c; ./a.out
-1


###
Since strcmp is re-defined in Line # 3, therefore, the correct output should be
-1.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180411/c150509d/attachment-0001.html>


More information about the llvm-bugs mailing list