<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Annex K functions"
   href="https://bugs.llvm.org/show_bug.cgi?id=43848">43848</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Annex K functions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>8.0
          </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>C11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jeff.linahan@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I was expecting to see something along the lines of "Annex K functions not
supported" or "__STDC_LIB_EXT1__ not defined" if memcmp_s was not declared, but
clang seems to be ignoring the -std=c11 flag and interpreting this as C99 code
instead.

// memcmp.c
#define __STDC_WANT_LIB_EXT1__ 1                                                
#include <string.h>

int main()
{
        char dst[10], src[10];
        memcmp_s(dst, 10, src, 10);
}

$ clang -std=c11 memcmp.c -o memcmp.exe
memcmp.c:7:2: warning: implicit declaration of function 'memcmp_s' is invalid
in C99 [-Wimplicit-function-declaration]
        memcmp_s(dst, 10, src, 10);
        ^
1 warning generated.
/usr/bin/ld: /tmp/memcmp-b97369.o: in function `main':
memcmp.c:(.text+0x1c): undefined reference to `memcmp_s'
clang: error: linker command failed with exit code 1 (use -v to see invocation)


This is clang 8.0.0-3 on x86_64-pc-linux-gnu</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>