[llvm-bugs] [Bug 43848] New: Annex K functions

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 30 08:54:58 PDT 2019


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

            Bug ID: 43848
           Summary: Annex K functions
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jeff.linahan at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

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

-- 
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/20191030/652cf5be/attachment.html>


More information about the llvm-bugs mailing list