[cfe-dev] Clang-tidy crashes when string reference used as parameter

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Tue Sep 4 10:56:20 PDT 2018


Hi Stuart,

i can reproduce the issue, but it is not within clang-tidy, directly but
in the CSA. The following invocation is the only invocation that results
in the segfault.

~/opt/llvm/build/bin/clang-tidy
-checks=-*,clang-analyzer-cplusplus.InnerPointer clang-tidy-bug.cpp --

The bug is reported here: https://bugs.llvm.org/show_bug.cgi?id=38827

Best, Jonas


Am 04.09.2018 um 15:51 schrieb Stuart Thomson via cfe-dev:
>
> Hi,
>
>  
>
> The following causes clang-tidy to crash:
>
>  
>
> test.cpp:
>
> #include <string>
>
>  
>
> void func(std::string& s){s.c_str();}
>
>  
>
> command:
>
> clang-tidy test.cpp --
>
>  
>
> I am on Windows, using clang 8 built from trunk last week. Clang-tidy
> still crashes when changing c_str() to data(), but does not crash if
> the parameter used is instead std::string s. Clang-check does not
> crash at all and is able to produce the AST.
>
>  
>
> Regards,
>
> Stuart
>
>  
>
>
>
> _______________________________________________
> 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/20180904/da4cf617/attachment.html>


More information about the cfe-dev mailing list