Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy segfault in <eof> parser at end of file #53359

Closed
def- opened this issue Jan 22, 2022 · 6 comments
Closed

clang-tidy segfault in <eof> parser at end of file #53359

def- opened this issue Jan 22, 2022 · 6 comments
Labels
bug Indicates an unexpected problem or unintended behavior clang-tidy duplicate Resolved as duplicate

Comments

@def-
Copy link

def- commented Jan 22, 2022

Error running 'clang-tidy': PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: clang-tidy --extra-arg-before=--driver-mode=g++ /media/ddnet/src/game/editor/layer_sounds.cpp -- /usr/bin/c++ -DCONF_DEBUG -DCONF_GLEW_HAS_CONTEXT_INIT -DCONF_INFORM_UPDATE -DGAME_RELEASE_VERSION=\"15.8.1\" -DGLEW_STATIC -I/media/ddnet/src -isystem /media/ddnet/ddnet-libs/curl/include -isystem /usr/include/freetype2 -isystem /media/ddnet/src/engine/external/glew -isystem /media/ddnet/ddnet-libs/opus/include -isystem /media/ddnet/ddnet-libs/opus/include/opus -isystem /media/ddnet/src/engine/external/pnglite -isystem /usr/include/SDL2 -isystem /media/ddnet/src/engine/external/wavpack -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/glib-2.0 -isystem /usr/lib/glib-2.0/include -isystem /usr/include/sysprof-4 -isystem /usr/include/libpng16 -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /media/ddnet/ddnet-libs/sqlite3/include -isystem /media/ddnet/src/engine/external/zlib -g -fdiagnostics-color=always -fstack-protector-all -fno-exceptions -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wno-nullability-completeness -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -std=gnu++11 -MD -MT CMakeFiles/DDNet.dir/src/game/editor/layer_sounds.cpp.o -MF CMakeFiles/DDNet.dir/src/game/editor/layer_sounds.cpp.o.d -o CMakeFiles/DDNet.dir/src/game/editor/layer_sounds.cpp.o -c /media/ddnet/src/game/editor/layer_sounds.cpp
1.	<eof> parser at end of file
 #0 0x00007efe04962c93 (/usr/bin/../lib/libLLVM-13.so+0xba2c93)
 #1 0x00007efe049604a6 (/usr/bin/../lib/libLLVM-13.so+0xba04a6)
 #2 0x00007efe038d6da0 __restore_rt sigaction.c:0:0
 #3 0x000055be85838720 (/usr/bin/clang-tidy+0x537720)
 #4 0x00007efe0b893a7e (/usr/bin/../lib/libclang-cpp.so.13+0x12a5a7e)
 #5 0x00007efe0b8bd42f clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/usr/bin/../lib/libclang-cpp.so.13+0x12cf42f)
 #6 0x00007efe0b894526 (/usr/bin/../lib/libclang-cpp.so.13+0x12a6526)
 #7 0x00007efe0b8b3ea1 (/usr/bin/../lib/libclang-cpp.so.13+0x12c5ea1)
 #8 0x00007efe0b8ae882 (/usr/bin/../lib/libclang-cpp.so.13+0x12c0882)
 #9 0x00007efe0b8aea8c (/usr/bin/../lib/libclang-cpp.so.13+0x12c0a8c)
#10 0x00007efe0b8b3013 (/usr/bin/../lib/libclang-cpp.so.13+0x12c5013)
#11 0x00007efe0b8aa54a (/usr/bin/../lib/libclang-cpp.so.13+0x12bc54a)
#12 0x00007efe0b8b8499 (/usr/bin/../lib/libclang-cpp.so.13+0x12ca499)
#13 0x00007efe0b8a9be0 (/usr/bin/../lib/libclang-cpp.so.13+0x12bbbe0)
#14 0x00007efe0b8a9e50 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.13+0x12bbe50)
#15 0x00007efe0cdbcc38 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.13+0x27cec38)
#16 0x00007efe0b1dbe59 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib/libclang-cpp.so.13+0xbede59)
#17 0x00007efe0cd81899 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.13+0x2793899)
#18 0x00007efe0cd0b9ec clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib/libclang-cpp.so.13+0x271d9ec)
#19 0x00007efe0cf7d5d6 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/usr/bin/../lib/libclang-cpp.so.13+0x298f5d6)
#20 0x000055be858f8aab (/usr/bin/clang-tidy+0x5f7aab)
#21 0x00007efe0cf77241 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (/usr/bin/../lib/libclang-cpp.so.13+0x2989241)
#22 0x00007efe0cf79b6d clang::tooling::ToolInvocation::run() (/usr/bin/../lib/libclang-cpp.so.13+0x298bb6d)
#23 0x00007efe0cf7baf4 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/usr/bin/../lib/libclang-cpp.so.13+0x298daf4)
#24 0x000055be85900676 (/usr/bin/clang-tidy+0x5ff676)
#25 0x000055be853ae9f9 (/usr/bin/clang-tidy+0xad9f9)
#26 0x00007efe038c1b25 __libc_start_main (/usr/bin/../lib/libc.so.6+0x27b25)
#27 0x000055be853a6f9e (/usr/bin/clang-tidy+0xa5f9e)
Segmentation fault

Reproducable with:

git clone https://github.com/def-/ddnet
git checkout crash-clang-tidy
cmake -DCMAKE_CXX_CLANG_TIDY="clang-tidy" -DCMAKE_C_CLANG_TIDY="clang-tidy" -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DPREFER_BUNDLED_LIBS=ON -GNinja .
ninja
@EugeneZelenko
Copy link
Contributor

EugeneZelenko commented Jan 22, 2022

Is this code compiled with Clang of same version? Is it possible to create isolated reproducer test case? Did you try to disable Clang-tidy checks?

@def-
Copy link
Author

def- commented Jan 22, 2022

$ clang-tidy --version
LLVM (http://llvm.org/):
  LLVM version 13.0.0
  Optimized build.
  Default target: x86_64-pc-linux-gnu
  Host CPU: skylake
$ clang-tidy --checks='-*,readability-static-accessed-through-instance' foo.cpp
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: clang-tidy --checks=-*,readability-static-accessed-through-instance foo.cpp
1.	<eof> parser at end of file
 #0 0x00007ff9556c7c93 (/usr/bin/../lib/libLLVM-13.so+0xba2c93)
 #1 0x00007ff9556c54a6 (/usr/bin/../lib/libLLVM-13.so+0xba04a6)
 #2 0x00007ff95463bda0 __restore_rt sigaction.c:0:0
 #3 0x000055569a18e720 (/usr/bin/clang-tidy+0x537720)
 #4 0x00007ff95c5f8a7e (/usr/bin/../lib/libclang-cpp.so.13+0x12a5a7e)
 #5 0x00007ff95c62242f clang::ast_matchers::internal::BoundNodesTreeBuilder::visitMatches(clang::ast_matchers::internal::BoundNodesTreeBuilder::Visitor*) (/usr/bin/../lib/libclang-cpp.so.13+0x12cf42f)
 #6 0x00007ff95c5f9526 (/usr/bin/../lib/libclang-cpp.so.13+0x12a6526)
 #7 0x00007ff95c618ea1 (/usr/bin/../lib/libclang-cpp.so.13+0x12c5ea1)
 #8 0x00007ff95c613882 (/usr/bin/../lib/libclang-cpp.so.13+0x12c0882)
 #9 0x00007ff95c613a8c (/usr/bin/../lib/libclang-cpp.so.13+0x12c0a8c)
#10 0x00007ff95c618013 (/usr/bin/../lib/libclang-cpp.so.13+0x12c5013)
#11 0x00007ff95c60f54a (/usr/bin/../lib/libclang-cpp.so.13+0x12bc54a)
#12 0x00007ff95c61d499 (/usr/bin/../lib/libclang-cpp.so.13+0x12ca499)
#13 0x00007ff95c60ebe0 (/usr/bin/../lib/libclang-cpp.so.13+0x12bbbe0)
#14 0x00007ff95c60ee50 clang::ast_matchers::MatchFinder::matchAST(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.13+0x12bbe50)
#15 0x00007ff95db21c38 clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/bin/../lib/libclang-cpp.so.13+0x27cec38)
#16 0x00007ff95bf40e59 clang::ParseAST(clang::Sema&, bool, bool) (/usr/bin/../lib/libclang-cpp.so.13+0xbede59)
#17 0x00007ff95dae6899 clang::FrontendAction::Execute() (/usr/bin/../lib/libclang-cpp.so.13+0x2793899)
#18 0x00007ff95da709ec clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/bin/../lib/libclang-cpp.so.13+0x271d9ec)
#19 0x00007ff95dce25d6 clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (/usr/bin/../lib/libclang-cpp.so.13+0x298f5d6)
#20 0x000055569a24eaab (/usr/bin/clang-tidy+0x5f7aab)
#21 0x00007ff95dcdc241 clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (/usr/bin/../lib/libclang-cpp.so.13+0x2989241)
#22 0x00007ff95dcdeb6d clang::tooling::ToolInvocation::run() (/usr/bin/../lib/libclang-cpp.so.13+0x298bb6d)
#23 0x00007ff95dce0af4 clang::tooling::ClangTool::run(clang::tooling::ToolAction*) (/usr/bin/../lib/libclang-cpp.so.13+0x298daf4)
#24 0x000055569a256676 (/usr/bin/clang-tidy+0x5ff676)
#25 0x0000555699d049f9 (/usr/bin/clang-tidy+0xad9f9)
#26 0x00007ff954626b25 __libc_start_main (/usr/bin/../lib/libc.so.6+0x27b25)
#27 0x0000555699cfcf9e (/usr/bin/clang-tidy+0xa5f9e)
zsh: segmentation fault (core dumped)  clang-tidy --checks='-*,readability-static-accessed-through-instance' foo.cpp

foo.zip
Minimal example with the preprocessor run so it doesn't depend on headers:

void CLayerTiles::Render(bool Tileset)
{
 	ColorRGBA Color = ColorRGBA(m_Color.r / 255.0f, m_Color.g / 255.0f, m_Color.b / 255.0f, m_Color.a / 255.0f);
        m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_TRANSPARENT,
  m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset);
}

@EugeneZelenko EugeneZelenko added bug Indicates an unexpected problem or unintended behavior clang-tidy and removed new issue labels Jan 23, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 23, 2022

@llvm/issue-subscribers-clang-tidy

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 23, 2022

@llvm/issue-subscribers-bug

@EugeneZelenko
Copy link
Contributor

Please add Color definition to minimal example. Crash also happened with recent main.

@PiotrZSL
Copy link
Member

PiotrZSL commented Aug 6, 2023

Duplicate of #53874
Crash happen in StaticAccessedThroughInstanceCheck, fixed in Clang 15
Fixed by ac616fb

@PiotrZSL PiotrZSL closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
@PiotrZSL PiotrZSL added the duplicate Resolved as duplicate label Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior clang-tidy duplicate Resolved as duplicate
Projects
None yet
Development

No branches or pull requests

4 participants