Bug 432078 - Crash when building with 'ENABLE_CLAZY'
Summary: Crash when building with 'ENABLE_CLAZY'
Status: RESOLVED DOWNSTREAM
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-25 08:25 UTC by Christophe Marin
Modified: 2021-01-30 21:32 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
generated files for debug (1.02 MB, application/gzip)
2021-01-25 08:28 UTC, Christophe Marin
Details
output of run_tests.py (963.93 KB, text/plain)
2021-01-25 23:57 UTC, Ahmad Samir
Details
cpp (818.04 KB, application/gzip)
2021-01-26 00:01 UTC, Ahmad Samir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Marin 2021-01-25 08:25:33 UTC
Clazy 1.9.1
llvm/clang 11.0.1

All KDE projects built with -DENABLE_CLAZY=ON result in a compiler crash

eg kimageformats:

Stack dump:
0.      Program arguments: /usr/bin/clang++ -DKF_DEPRECATED_WARNINGS_SINCE=0x060000 -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054B00 -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_DISABLE_DEPRECATED_BEFORE=0x050e00 -DQT_GUI_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_FOREACH -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_QSTRINGBUILDER -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -Dkimg_ani_EXPORTS -Isrc/imageformats -I/data/kde/src/kimageformats/src/imageformats -Isrc/imageformats/kimg_ani_autogen/include -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -Wall -Wextra -Wmissing-include-dirs -Qunused-arguments -fcolor-diagnostics -fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -fdiagnostics-color=always -pedantic -Wzero-as-null-pointer-constant -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -std=gnu++14 -MD -MT src/imageformats/CMakeFiles/kimg_ani.dir/kimg_ani_autogen/mocs_compilation.cpp.o -MF src/imageformats/CMakeFiles/kimg_ani.dir/kimg_ani_autogen/mocs_compilation.cpp.o.d -o src/imageformats/CMakeFiles/kimg_ani.dir/kimg_ani_autogen/mocs_compilation.cpp.o -c src/imageformats/kimg_ani_autogen/mocs_compilation.cpp -Xclang -load -Xclang ClazyPlugin.so -Xclang -add-plugin -Xclang clazy 
1.      <eof> parser at end of file
 #0 0x00007f9dc62bd88d llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib64/libLLVM.so.11+0xa5088d)
 #1 0x00007f9dc62bb200 llvm::sys::RunSignalHandlers() (/usr/lib64/libLLVM.so.11+0xa4e200)
 #2 0x00007f9dc62bcc40 llvm::sys::CleanupOnSignal(unsigned long) (/usr/lib64/libLLVM.so.11+0xa4fc40)
 #3 0x00007f9dc61d7bbb (/usr/lib64/libLLVM.so.11+0x96abbb)
 #4 0x00007f9dc54feb70 __restore_rt (/lib64/libc.so.6+0x3db70)
 #5 0x00007f9dcbb2c35e (/usr/lib64/libclang-cpp.so.11+0xdfd35e)
 #6 0x00007f9dcbb2cc5e (/usr/lib64/libclang-cpp.so.11+0xdfdc5e)
 #7 0x00007f9dcbb2cc5e (/usr/lib64/libclang-cpp.so.11+0xdfdc5e)
 #8 0x00007f9dcbb2cc5e (/usr/lib64/libclang-cpp.so.11+0xdfdc5e)
 #9 0x00007f9dcbb2c31e clang::ParentMap::ParentMap(clang::Stmt*) (/usr/lib64/libclang-cpp.so.11+0xdfd31e)
#10 0x00007f9dc501f09d ClazyASTConsumer::VisitStmt(clang::Stmt*) /usr/src/debug/clazy-1.9-1.1.x86_64/src/Clazy.cpp:143:9
#11 0x00007f9dc5032029 clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseCXXNewExpr(clang::CXXNewExpr*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) /usr/include/clang/AST/RecursiveASTVisitor.h:2414:1
#12 0x00007f9dc50285df clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseStmt(clang::Stmt*, llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool, llvm::PointerLikeTypeTraits<clang::Stmt*>, llvm::PointerIntPairInfo<clang::Stmt*, 1u, llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) /usr/include/clang/AST/RecursiveASTVisitor.h:599:7
#13 0x00007f9dc502677b clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseFunctionDecl(clang::FunctionDecl*) /usr/include/clang/AST/RecursiveASTVisitor.h:0:1
#14 0x00007f9dc5022e90 clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseDecl(clang::Decl*) /usr/include/clang/AST/DeclNodes.inc:401:1
#15 0x00007f9dc5027f4b clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseDeclContextHelper(clang::DeclContext*) /usr/include/clang/AST/RecursiveASTVisitor.h:1383:7
#16 0x00007f9dc5027e98 clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*) /usr/include/clang/AST/RecursiveASTVisitor.h:1484:1
#17 0x00007f9dc5023186 clang::RecursiveASTVisitor<ClazyASTConsumer>::TraverseDecl(clang::Decl*) /usr/include/clang/AST/DeclNodes.inc:595:1
#18 0x00007f9dc501f35d ClazyASTConsumer::HandleTranslationUnit(clang::ASTContext&) /usr/src/debug/clazy-1.9-1.1.x86_64/src/Clazy.cpp:0:5
#19 0x00007f9dcd5120cc clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) (/usr/lib64/libclang-cpp.so.11+0x27e30cc)
#20 0x00007f9dcb674d55 clang::ParseAST(clang::Sema&, bool, bool) (/usr/lib64/libclang-cpp.so.11+0x945d55)
#21 0x00007f9dccab0d62 clang::CodeGenAction::ExecuteAction() (/usr/lib64/libclang-cpp.so.11+0x1d81d62)
#22 0x00007f9dcd4dbe94 clang::FrontendAction::Execute() (/usr/lib64/libclang-cpp.so.11+0x27ace94)
#23 0x00007f9dcd48fcdd clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib64/libclang-cpp.so.11+0x2760cdd)
#24 0x00007f9dcd560be6 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib64/libclang-cpp.so.11+0x2831be6)
#25 0x0000000000412de2 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+++0x412de2)
#26 0x000000000041123b (/usr/bin/clang+++0x41123b)
#27 0x00007f9dcd117f82 (/usr/lib64/libclang-cpp.so.11+0x23e8f82)
#28 0x00007f9dc61d7659 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/usr/lib64/libLLVM.so.11+0x96a659)
#29 0x00007f9dcd1175a9 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool*) const (/usr/lib64/libclang-cpp.so.11+0x23e85a9)
#30 0x00007f9dcd0ecde3 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/usr/lib64/libclang-cpp.so.11+0x23bdde3)
#31 0x00007f9dcd0ed1aa clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/usr/lib64/libclang-cpp.so.11+0x23be1aa)
#32 0x00007f9dcd1019dc clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/usr/lib64/libclang-cpp.so.11+0x23d29dc)
#33 0x0000000000410c5f main (/usr/bin/clang+++0x410c5f)
#34 0x00007f9dc54e9152 __libc_start_main /usr/src/debug/glibc-2.32-4.1.x86_64/csu/../csu/libc-start.c:314:16
#35 0x000000000040e0ce _start (/usr/bin/clang+++0x40e0ce)
Comment 1 Christophe Marin 2021-01-25 08:28:40 UTC
Created attachment 135152 [details]
generated files for debug
Comment 2 Sergio Martins 2021-01-25 16:22:27 UTC
which distro ?

Ahmad Samir, which distro too ?
Comment 3 Ahmad Samir 2021-01-25 16:27:41 UTC
Opensuse tumbleweed.
Comment 4 Sergio Martins 2021-01-25 23:28:30 UTC
Can't reproduce on Archlinux.

What's the output of:
$ cd clazy/tests 
$ ./run_tests.py --verbose

(git clone git@invent.kde.org:sdk/clazy.git if needed)
Comment 5 Ahmad Samir 2021-01-25 23:57:35 UTC
Created attachment 135186 [details]
output of run_tests.py
Comment 6 Ahmad Samir 2021-01-26 00:01:30 UTC
Created attachment 135187 [details]
cpp
Comment 7 Sergio Martins 2021-01-26 10:24:01 UTC
Can you build clazy itself and see if you can repro

cmake -DCMAKE_BUILD_TYPE=Debug .
cmake --build .
the ClazyPlugin.so path to LD_LIBRARY_PATH and rerun the tests
(remove the system package if needed)
Comment 8 Ahmad Samir 2021-01-26 12:12:44 UTC
I built clazy and all the tests passed; then I rebuilt and reinstalled the rpm package, and now it works....

The rpm changelog:
  * Sat Jan 09 2021 Aaron Puchert <aaronpuchert@alice-dsl.net>
  - Update to version 11.0.1.
    * This release contains bug-fixes for the LLVM 11.0.0 release.
      This release is API and ABI compatible with 11.0.0.
  
  * Mon Oct 19 2020 Aaron Puchert <aaronpuchert@alice-dsl.net>
  - Update to version 11.0.0.
    * For details, see the release notes:
    - https://releases.llvm.org/11.0.0/docs/ReleaseNotes.html
[...]

apparently something broke between 11.0.0 and .1.
Comment 9 Christophe Marin 2021-01-26 13:38:50 UTC
Looks like the clazy package wasn't rebuilt after the llvm 11.0.1 update (which isn't supposed to contain ABI changes).

I've now added stricter checks in the package.
Comment 10 Ahmad Samir 2021-01-26 15:10:13 UTC
Thanks for the speedy solution, up and down stream :)
Comment 11 Christophe Marin 2021-01-27 07:58:54 UTC
FTR, the openSUSE llvm maintainer found a commit that changed ABI in the 11.0.1 release (https://github.com/llvm/llvm-project/commit/adf84530)

Quoting him:

« Culprit is a commit that changed clang/include/clang/Basic/Attr.td, which added the line INHERITABLE_ATTR(Builtin) somewhere to the middle of /usr/include/clang/Basic/AttrList.inc, which is included in /usr/include/clang/Basic/AttrKinds.h into an enumeration. »