[llvm-bugs] [Bug 27592] New: __builtin_strcmp in -O0 generates call to non-#included strcmp

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 1 05:47:27 PDT 2016


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

            Bug ID: 27592
           Summary: __builtin_strcmp in -O0 generates call to
                    non-#included strcmp
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hmijail at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ cat builtin.c 
#include <stdio.h>
int main(void){
  printf("%d", __builtin_strcmp("asfd", "asdf"));
}

$ clang-3.9 builtin.c -O0

$ objdump -T a.out

a.out:     file format elf64-x86-64

DYNAMIC SYMBOL TABLE:
0000000000000000      DF *UND*    0000000000000000  GLIBC_2.2.5 printf
0000000000000000      DF *UND*    0000000000000000  GLIBC_2.2.5
__libc_start_main
0000000000000000      DF *UND*    0000000000000000  GLIBC_2.2.5 strcmp
0000000000000000  w   D  *UND*    0000000000000000              __gmon_start__

When compiling with -O1, the strcmp call is no longer there.

I am not sure how serious this is, but given that clang won't allow me to call
strcmp() without #include <string.h>, it's kinda suspicious that it does so
itself.

-- 
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/20160501/b799fed7/attachment.html>


More information about the llvm-bugs mailing list