<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - __builtin_strcmp in -O0 generates call to non-#included strcmp"
   href="https://llvm.org/bugs/show_bug.cgi?id=27592">27592</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__builtin_strcmp in -O0 generates call to non-#included strcmp
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hmijail@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>