[cfe-dev] clang-cl mysteriously shuts up with --analyze

Nikola Smiljanic via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 22 19:16:57 PST 2015


My guess would be that --analyze invokes the static analyzer and so the
whole linking step is skipped.

On Wed, Dec 23, 2015 at 5:15 AM, <Alexander G. Riccio> via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> When I try to build a simple C program (attached), clang-cl warns about
> some - unrelated to this question - linking issue:
>
> C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl
> basically_flawed_c_program.c
> basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external
> symbol malloc referenced in function main
> basically_flawed_c_program-1f4f44.obj : error LNK2019: unresolved external
> symbol free referenced in function main
> LINK : error LNK2001: unresolved external symbol mainCRTStartup
> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\libcmt.lib :
> warning LNK4272: library machine type 'X86' conflicts with target machine
> type 'x64'
> basically_flawed_c_program.exe : fatal error LNK1120: 3 unresolved
> externals
> clang-cl.exe: error: linker command failed with exit code 1120 (use -v to
> see invocation)
>
> ...but when I pass --analyze to clang-cl, it shuts up entirely:
>
> C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>clang-cl
> --analyze basically_flawed_c_program.c
>
> C:\Users\Alexander Riccio\Documents\basically_flawed_c_program>
>
>
> What's going on here??
>
> I'm more interested in why the --analyze flag shuts clang-cl up, than I
> am the strange linker error; but bonus points if you know what's going on
> there too.
>
> I'm also attaching the verbose invocations of the two commands.
>
>
> Sincerely,
> Alexander Riccio
> --
> "Change the world or go home."
> about.me/ariccio
>
> <http://about.me/ariccio>
> If left to my own devices, I will build more.
>>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151223/624f0559/attachment.html>


More information about the cfe-dev mailing list