Menu

Segmentation fault (using clang)

2022-06-27
2022-07-07
  • Gaetano Mendola

    Gaetano Mendola - 2022-06-27

    The following snippet drives cppcheck to segfault when using it with --clang

    #include <type_traits>
    #include <stdint.h>
    
    std::enable_if_t<sizeof(uint64_t)==8>
    foo() {
    }
    
    float bar() {
    }
    
    int main() {
      foo();
      bar();
    }
    
     
  • CHR

    CHR - 2022-06-28

    With head I get

    Checking bar.cpp...
    Bailing out from checking bar.cpp since there was an internal error: invalid stoull argument
    

    What is your exact command line?

     
  • Gaetano Mendola

    Gaetano Mendola - 2022-07-06

    ~/Downloads/cppcheck-2.8/cppcheck --clang main.cpp
    Checking main.cpp...
    Segmentation fault (core dumped)

    $ clang --version
    Ubuntu clang version 15.0.0-++20220706104508+5d8077565e41-1~exp1~20220706104611.584
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin

     
  • Gaetano Mendola

    Gaetano Mendola - 2022-07-06

    Backtrace:

    Program received signal SIGSEGV, Segmentation fault.
    0x00005555557e7b23 in Token::tokAt(int) const ()
    (gdb) bt
    #0  0x00005555557e7b23 in Token::tokAt(int) const ()
    #1  0x000055555579b225 in isUnknownType(Token const*, Token const*) ()
    #2  0x000055555579e89b in Function::returnsReference(Function const*, bool) ()
    #3  0x00005555558792dd in valueFlowLifetimeFunction(Token*, TokenList*, ErrorLogger*, Settings const*) ()
    #4  0x0000555555883bfb in valueFlowLifetime(TokenList*, SymbolDatabase*, ErrorLogger*, Settings const*) [clone .constprop.0] ()
    #5  0x0000555555887a1b in ValueFlow::setValues(TokenList*, SymbolDatabase*, ErrorLogger*, Settings const*) ()
    #6  0x0000555555712ef5 in CppCheck::check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
    #7  0x00005555558af15f in CppCheckExecutor::check_internal(CppCheck&) ()
    #8  0x00005555558b15cc in CppCheckExecutor::check(int, char const* const*) ()
    #9  0x00005555555ffcf2 in main ()
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.