[cfe-dev] Possible bug in CLang 3.7.1 / 3.8.0
Brian Cain via cfe-dev
cfe-dev at lists.llvm.org
Fri Mar 25 05:06:57 PDT 2016
I can confirm this behavior change between 3.6 and 3.7.0. gcc-4.9 and
5.2.1 behave the same way as clang-3.6.
On Fri, Mar 25, 2016 at 5:26 AM, Aleksander Alekseev via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> Hello
>
> Here is a test program:
>
> ```
> #include <string.h>
>
> int main()
> {
> (void)strlcpy;
> return 0;
> }
> ```
>
> When I compile it using clang 3.6 compiler reports an error:
>
> ```
> $ /usr/bin/clang-3.6 str.c -o str
> str.c:5:9: error: use of undeclared identifier 'strlcpy'; did you mean
> 'struct'?
>
> str.c:5:9: error: expected expression
> 2 errors generated.
> ```
>
> Its OK, this is an expected behavior.
>
> But newer versions of CLang somehow manage to build this program:
>
> ```
> $ /usr/local/bin/clang-3.7 str.c -o str
>
> str.c:5:9: warning: implicitly declaring library function 'strlcpy'
> with type 'unsigned long (char *, const char *, unsigned
> long)'
>
> str.c:5:9: note: include the header <string.h> or explicitly provide a
> declaration for 'strlcpy'
>
> 1 warning generated.
>
> $ ./str
>
> $ /usr/local/bin/clang-3.8 str.c -o str
>
> str.c:5:9: warning: implicitly declaring library function 'strlcpy'
> with type 'unsigned long (char *, const char *, unsigned
> long)' [-Wimplicit-function-declaration]
>
> str.c:5:9: note: include the header <string.h> or explicitly provide a
> declaration for 'strlcpy' 1 warning generated.
> ```
>
> First of all <string.h> is already included. Also there is no strlcpy
> procedure on this system at all (Ubuntu Linux 14.04 x64). Thus this
> program should not compile.
>
> It seems to be a serious bug since projects that use Autotools rely on
> clang 3.6 behaviour while checking weather current system has strlcpy
> procedure.
>
> Or maybe I just don't understand something?
>
> --
> Best regards,
> Aleksander Alekseev
> http://eax.me/
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
--
-Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160325/ec92dbf5/attachment.html>
More information about the cfe-dev
mailing list