[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 Bernhard Rosenkränzer changed: What|Removed |Added Status|RESOLVED|REOPENED CC||b...@lindev.ch Resolution|FIXED |--- --- Comment #12 from Bernhard Rosenkränzer --- The bug in clang has been fixed a long time ago, but clazy still disables the functionality when built with clang. The workaround should be limited to the versions of clang affected by the bug (anything between 7.0 and 8.0). https://invent.kde.org/sdk/clazy/-/merge_requests/57 -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 Sergio Martins changed: What|Removed |Added Latest Commit||https://commits.kde.org/cla ||zy/d6cb7569816ce11160a2eeeb ||d58a92a345b59f70 Resolution|--- |FIXED Status|CONFIRMED |RESOLVED --- Comment #11 from Sergio Martins --- Git commit d6cb7569816ce11160a2eeebd58a92a345b59f70 by Sergio Martins. Committed on 22/09/2018 at 19:25. Pushed by smartins into branch '1.3'. Workaround crash with LLVM 7 If clazy is compiled with clang instead of gcc it might crash with: ==10637== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==10637== Access not within mapped region at address 0x8 ==10637==at 0x19CDD8C: clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions) (in /usr/lib/llvm-7/bin/clang) ==10637==by 0x9D75670: ClazyASTConsumer (Clazy.cpp:62) ==10637==by 0x9D75670: ClazyASTAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef) (Clazy.cpp:183) ==10637==by 0x9E29ED: clang::FrontendAction::CreateWrappedASTConsumer(clang::CompilerInstance&, llvm::StringRef) (in /usr/lib/llvm-7/bin/clang) ==10637==by 0x9E8FCA: clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) (in /usr/lib/llvm-7/bin/clang) ==10637==by 0x9AE3D5: clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (in /usr/lib/llvm-7/bin/clang) ==10637==by 0xA8C9FA: clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (in /usr/lib/llvm-7/bin/clang) ==10637==by 0x5822C7: cc1_main(llvm::ArrayRef, char const*, void*) (in /usr/lib/llvm-7/bin/clang) ==10637==by 0x571ACC: main (in /usr/lib/llvm-7/bin/clang) After debugging clazy and clang's code I couldn't find anything wrong with it. Valgrind's output doesn't make much sense, and simply compiling the Clazy.cpp translation unit with gcc instead of clang makes the crash go away and valgrind's output is clean. I'm assuming debian's LLVM was built with gcc and building clazy with clang will have some sort of incompatibility, or maybe it's simply a clang bug. The downside of this workaround is that qcolor-literal check will be disabled. Next step will be producing a minimal test case and reporting to LLVM. CCMAIL: woebbek...@kde.org M +6-0CMakeLists.txt M +7-0src/Clazy.cpp https://commits.kde.org/clazy/d6cb7569816ce11160a2eeebd58a92a345b59f70 -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #10 from Sergio Martins --- Is this still happening with latest clazy ? -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #9 from Sergio Martins --- Git commit 36dadd0e6d33101d0f26248376f2f1cbda5d8793 by Sergio Martins. Committed on 19/09/2018 at 18:30. Pushed by smartins into branch '1.3'. prospective fix for crash with clang-7.0 This shuffles the code around in hope of avoiding what seems to be a clang bug. The backtrace and valgrind report don't make sense to me, and the crash goes away if building clazy with gcc. M +5-2src/Clazy.cpp M +1-1src/Clazy.h https://commits.kde.org/clazy/36dadd0e6d33101d0f26248376f2f1cbda5d8793 -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #8 from Sergio Martins--- Reproduced. It only happens when using clang as compiler, building clazy with gcc is fine. This looks like a clang 7.0 bug. -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 Sergio Martinschanged: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |CONFIRMED -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 Sergio Martinschanged: What|Removed |Added Assignee|unassigned-b...@kde.org |smart...@kde.org -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #7 from eric.lemaniss...@gmail.com --- sudo apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update --quiet sudo apt-get install --quiet --yes --no-install-recommends wget ca-certificates gnupg2 wget https://apt.llvm.org/llvm-snapshot.gpg.key && sudo apt-key add llvm-snapshot.gpg.key echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main" > /etc/apt/sources.list.d/llvm.list sudo apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update --quiet sudo apt-get install --quiet --yes --no-install-recommends make libstdc++-7-dev clang-7 zlib1g-dev libglib2.0-0 llvm-7-dev libclang-7-dev git cmake python libgl1-mesa-glx -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #6 from Sergio Martins--- If you paste the commands I need to install that specific llvm I'll give it a go. I have a ubuntu 16.04 docker -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #5 from eric.lemaniss...@gmail.com --- I forgot to mention : the last test was performed using llvm and clang from http://apt.llvm.org/. Also, the same docker debian configuration works great when using clang/llvm 6.0 instead of 7 -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #4 from eric.lemaniss...@gmail.com --- I could not manage to build clang, so I tried another thing: building clazy inside the debian:unstable docker image. Unfortunately I hit the exact same wall as on native ubuntu 16.04 #0 0x7f9ce946685a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x93285a) #1 0x7f9ce9464b96 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x930b96) #2 0x7f9ce9464cb3 (/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x930cb3) #3 0x7f9cec729f50 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11f50) #4 0x55ebeee173c9 clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions) (/usr/lib/llvm-7/bin/clang+0x18483c9) #5 0x7f9ce58a9c11 ClazyASTAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef) (/usr/local/lib/ClangLazy.so+0x40ac11) #6 0x55ebede782cd clang::FrontendAction::CreateWrappedASTConsumer(clang::CompilerInstance&, llvm::StringRef) (/usr/lib/llvm-7/bin/clang+0x8a92cd) #7 0x55ebede7e76c clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) (/usr/lib/llvm-7/bin/clang+0x8af76c) #8 0x55ebede42da0 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/lib/llvm-7/bin/clang+0x873da0) #9 0x55ebedf218fb clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/lib/llvm-7/bin/clang+0x9528fb) #10 0x55ebeda3c8e8 cc1_main(llvm::ArrayRef, char const*, void*) (/usr/lib/llvm-7/bin/clang+0x46d8e8) #11 0x55ebeda2b4b7 main (/usr/lib/llvm-7/bin/clang+0x45c4b7) #12 0x7f9ce7c37a87 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21a87) #13 0x55ebeda3a24a _start (/usr/lib/llvm-7/bin/clang+0x46b24a) Stack dump: 0. Program arguments: /usr/lib/llvm-7/bin/clang -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-escaping-block-tail-calls -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /clazy/tests/main.gcno -resource-dir /usr/lib/llvm-7/lib/clang/7.0.0 -isystem /home/admin/Qt/5.8/gcc_64/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward -internal-isystem /usr/include/clang/7.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-unused-value -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /clazy/tests -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -load ClangLazy.so -add-plugin clang-lazy -plugin-arg-clang-lazy no-inplace-fixits -plugin-arg-clang-lazy auto-unexpected-qstringbuilder -plugin-arg-clang-lazy enable-all-fixits -o main.o -x c++ auto-unexpected-qstringbuilder/main.cpp clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal (use -v to see invocation) clang version 7.0.0- (trunk) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm-7/bin The cmake output is the following: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ROOT=/usr/lib/llvm-7 ../clazy -- The C compiler identification is Clang 7.0.0 -- The CXX compiler identification is Clang 7.0.0 -- Check for working C compiler: /usr/lib/llvm-7/bin/clang -- Check for working C compiler: /usr/lib/llvm-7/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/lib/llvm-7/bin/clang++ -- Check for working CXX compiler: /usr/lib/llvm-7/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found LLVM (version: 7.0.0): (using /usr/lib/llvm-7/bin/llvm-config) -- Include dirs: /usr/lib/llvm-7/include -- LLVM libraries: -lLLVM-7 -- LLVM System libraries: -- Found Clang (LLVM version: 7.0.0) -- Include dirs: /usr/lib/llvm-7/include -- Clang libraries:
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #2 from Sergio Martins--- works for me on ubuntu 16.04 too can you pastebin: - configure flags passed to llvm/clang - output of cmake when building clazy -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #3 from Sergio Martins--- If you want to try my steps: $ cd $ git clone https://github.com/llvm-mirror/llvm.git $ cd llvm/tools/ $ git clone https://github.com/llvm-mirror/clang.git $ cd .. $ cd projects/ $ git clone https://github.com/llvm-mirror/compiler-rt.git $ cd compiler-rt/ $ mkdir /root/llvm7/ # running with root on my docker container, change here :) $ cmake -DCMAKE_INSTALL_PREFIX=/root/llvm7 -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ../llvm $ make -j12 $ make install $ export PATH=/root/llvm7/bin/:$PATH $ export LD_LIBRARY_PATH=/root/llbm7/lib/:$LD_LIBRARY_PATH $ $ cd clazy/ $ git clean -fdx . $ git pull $ cmake -DCMAKE_INSTALL_PREFIX=/root/llvm7/ $ make && make install $ cd tests $ ./run_tests.py -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 --- Comment #1 from Sergio Martins--- Works for me with latest trunk, on archlinux. Are you sure you have a matching llvm and clang, and updated both repos ? -- You are receiving this mail because: You are watching all bug changes.
[clazy] [Bug 392223] segmentation fault
https://bugs.kde.org/show_bug.cgi?id=392223 eric.lemaniss...@gmail.com changed: What|Removed |Added CC||eric.lemaniss...@gmail.com -- You are receiving this mail because: You are watching all bug changes.