Skip to content

clang-repl: SIGSEGV in libclang #72980

Open
@p4vook

Description

@p4vook

Minimal example

echo "{ int x; a::b(x); }" | clang-repl

Expected result

Error is shown, but the evaluation continues

Actual result

Error is shown, clang-repl gets terminated by SIGSEGV.

Stack trace

LLVM 17.0.4

  * frame #0: 0x00007ffff5188a90 libclang-cpp.so.17`clang::Decl::getTranslationUnitDecl()
    frame #1: 0x00007ffff7b72f60 libclang-cpp.so.17`clang::IncrementalParser::CleanUpPTU(clang::PartialTranslationUnit&) + 192
    frame #2: 0x00007ffff7b74308 libclang-cpp.so.17`clang::IncrementalParser::ParseOrWrapTopLevelDecl() + 2264
    frame #3: 0x00007ffff7b74f4d libclang-cpp.so.17`clang::IncrementalParser::Parse(llvm::StringRef) + 1165
    frame #4: 0x00007ffff7b782b8 libclang-cpp.so.17`clang::Interpreter::ParseAndExecute(llvm::StringRef, clang::Value*) + 184
    frame #5: 0x00005555555614be clang-repl`main + 3534
    frame #6: 0x00007fffeaa5078a libc.so.6`___lldb_unnamed_symbol3154 + 122
    frame #7: 0x00007fffeaa50845 libc.so.6`__libc_start_main + 133
    frame #8: 0x000055555555c3b1 clang-repl`_start + 33

Also tested with current master (commit 0d77978), same result.

UPD: worth mentioning that clang++ itself processes this file correctly, without segfaults.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions