Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 252 forks source link

libclang crash #1018

Closed xinquanatcolezhu closed 6 years ago

xinquanatcolezhu commented 7 years ago

Please mark appropriate

Problem description

rdm crashes everytime when parsing my c++ project

Expected behavior

Describe what you expected to happen.

Actual behavior

This is the log from my emacs rdm buffer

rdm: /home/AD/xinquan.zhu/Downloads/cfe-4.0.0.src/lib/Basic/SourceManager.cpp:817: clang::FileID clang::SourceManager\ ::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
libclang: crash detected during parsing: {
'source_filename' : '/home/AD/xinquan.zhu/oms/src/OMSNode.cpp'
'command_line_args' : ['clang', '-std=c++14', '-Wall', '-c', '-DRTAGS=', '-DRTAGS=', '-I/tmp/cmake6768qR2/version/i\ nclude', '-I/tmp/cmake6768qR2', '-I/home/AD/xinquan.zhu/oms/include', '-I/tmp/cmake6768qR2/tmp/include', '-I/usr/incl\ ude/mysql', '-isystem', '/usr/lib64/', '-I/home/AD/xinquan.zhu/bitsx/bitsx-lib/include/', '-isystem', '/usr/local/lib\ /clang/4.0.0/include/', '-isystem', '/usr/lib64/', '-I/home/AD/xinquan.zhu/bitsx/bitsx-lib/include/', '-isystem', '/u\ sr/local/lib/clang/4.0.0/include/'],
'unsaved_files' : [],
'options' : 399,
}
Caught signal 11
/usr/local/bin/rdm[0x46efd6]
/lib64/libpthread.so.0(+0xf370)[0x7f907802e370]

Process rdm exited abnormally with code 1

Environment

Describe the feature we should add to RTags.

Andersbakken commented 7 years ago

Mostly I recommend compiling clang without assertions. I don't know what actually causes the assertions but I believe the condition generally is benign if ignored.

On Mon, Aug 7, 2017 at 5:29 AM, xinquanatcolezhu notifications@github.com wrote:

Please mark appropriate

  • rtags (rdm/rc/rp)
  • Emacs Lisp
    • ac-rtags.el
    • company-rtags.el
    • helm-rtags.el
    • flycheck-rtags.el
    • ivy-rtags.el
    • rtags.el

Problem description

Describe briefly the problem. rdm crashes when parsing my c++ project Expected behavior

Describe what you expected to happen. Actual behavior

Describe what actually happened. This is the log from my emacs rdm buffer

rdm: /home/AD/xinquan.zhu/Downloads/cfe-4.0.0.src/lib/Basic/SourceManager.cpp:817: clang::FileID clang::SourceManager ::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed. libclang: crash detected during parsing: { 'source_filename' : '/home/AD/xinquan.zhu/oms/src/OMSNode.cpp' 'command_line_args' : ['clang', '-std=c++14', '-Wall', '-c', '-DRTAGS=', '-DRTAGS=', '-I/tmp/cmake6768qR2/version/i nclude', '-I/tmp/cmake6768qR2', '-I/home/AD/xinquan.zhu/oms/include', '-I/tmp/cmake6768qR2/tmp/include', '-I/usr/incl ude/mysql', '-isystem', '/usr/lib64/', '-I/home/AD/xinquan.zhu/bitsx/bitsx-lib/include/', '-isystem', '/usr/local/lib /clang/4.0.0/include/', '-isystem', '/usr/lib64/', '-I/home/AD/xinquan.zhu/bitsx/bitsx-lib/include/', '-isystem', '/u sr/local/lib/clang/4.0.0/include/'], 'unsaved_files' : [], 'options' : 399, } Caught signal 11 /usr/local/bin/rdm[0x46efd6] /lib64/libpthread.so.0(+0xf370)[0x7f907802e370]

Process rdm exited abnormally with code 1 Environment

  • Your operating system: CentOS 7
  • LLVM/Clang version: 4.0

Feature request

Describe the feature we should add to RTags.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/1018, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEdSv_otPQcmJuLWqxKcli5372yuYFWks5sVwMagaJpZM4OvXtB .

xinquanatcolezhu commented 7 years ago

hi . i complied the clang without assertion. and get the following errors . your help is greatly appreicated.

that;s my emacs config

(use-package cmake-ide
  :bind  (("<f9>" . cmake-ide-compile))
  :config  (progn (setq
     cmake-ide-rdm-executable "/usr/local/bin/rdm"
     cmake-ide-rc-executable  "/usr/local/bin/rc"
     )))

(use-package rtags
  :config (progn
    (setq rtags-use-helm t)
    (setq rtags-autostart-diagnostics t)
    (rtags-diagnostics)
    (setq rtags-completions-enabled t)
    (push 'company-rtags company-backends)
    (add-hook 'c-mode-common-hook (lambda ()
                                    (when (rtags-is-indexed)
                                      (local-set-key (kbd "M-'") 'rtags-find-symbol-at-point)
                                      (local-set-key (kbd "M-.") 'rtags-find-symbol)
                                      (local-set-key (kbd "M-@") 'rtags-find-references)
                                      (local-set-key (kbd "M-;") 'rtags-location-stack-back))))
    (cmake-ide-setup)))
Running with 8 jobs, using args: -ferror-limit=50 -Wall -fspell-checking -Wno-unknown-warning-option                  
Includepaths: "-isystem" /usr/local/lib/clang/4.0.0/include/                                                          
Restoring /home/AD/xinquan.zhu/oms/ .........                                                                         
Restoring /home/AD/xinquan.zhu/bitsx/bitsx-lib/ ........                                                              
/usr/local/bin/rc -m --elisp                                                                                          
rdm: /home/AD/xinquan.zhu/s/cfe-4.0.0.src/include/clang/Basic/SourceLocation.h:319: bool clang::FullSourceLoc::isBefo\
reInTranslationUnitThan(clang::FullSourceLoc) const: Assertion `SrcMgr == Loc.SrcMgr && "Loc comes from another Sourc\
eManager!"' failed.                                                                                                   
libclang: crash detected during parsing: {                                                                            
  'source_filename' : '/home/AD/xinquan.zhu/oms/src/RedisAdaptor.cpp'                                                 
  'command_line_args' : ['clang', '-std=c++14', '-Wall', '-c', '-DRTAGS=', '-DRTAGS=', '-I/tmp/cmake269826te/version/\
include', '-I/tmp/cmake269826te', '-I/home/AD/xinquan.zhu/oms/include', '-I/tmp/cmake269826te/tmp/include', '-I/usr/i\
nclude/mysql', '-isystem', '/usr/local/lib/clang/4.0.0/include/', '-isystem', '/usr/local/lib/clang/4.0.0/include/', \
'-o', '/tmp/cmake269826te/CMakeFiles/runUnitTests.dir/src/RedisAdaptor.cpp.o'],                                       
  'unsaved_files' : [],                                                                                               
  'options' : 399,                                                                                                    
}                                                                                                                     
*** Error in `/usr/local/bin/rdm': corrupted double-linked list: 0x00007fb1843d6360 ***                               
======= Backtrace: =========                                                                                          
/lib64/libc.so.6(+0x7ada4)[0x7fb1948adda4]                                                                            
/lib64/libc.so.6(+0x7c595)[0x7fb1948af595]                                                                            
/usr/local/lib/libclang.so.4(+0x44328a)[0x7fb19648028a]                                                               
/usr/local/lib/libclang.so.4(+0x435401)[0x7fb196472401]                                                               
/usr/local/lib/libclang.so.4(+0x861cb1)[0x7fb19689ecb1]                                                               
/usr/local/lib/libclang.so.4(+0x861e86)[0x7fb19689ee86]                                                               
/usr/local/lib/libclang.so.4(+0x892aca)[0x7fb1968cfaca]                                                               
/usr/local/lib/libclang.so.4(+0x1d03a29)[0x7fb197d40a29]                                                              
/usr/local/lib/libclang.so.4(clang_parseTranslationUnit2FullArgv+0x48c)[0x7fb19645fe8d]                               
/usr/local/lib/libclang.so.4(clang_parseTranslationUnit2+0xe0)[0x7fb19645f95f]                                        
/usr/local/bin/rdm(_ZN5RTags15TranslationUnit6createERK4PathRK4ListI6StringEP13CXUnsavedFilei5FlagsI23CXTranslationUn\
it_FlagsEb+0x65e)[0x48191e]                                                                                           
/usr/local/bin/rdm(_ZN16CompletionThread7processEPNS_7RequestE+0x2350)[0x5949e0]                                      
/usr/local/bin/rdm(_ZN16CompletionThread3runEv+0x6d)[0x590c8d]                                                        
/usr/local/bin/rdm(_ZN6Thread10localStartEPv+0x25)[0x54c425]                                                          
/lib64/libpthread.so.0(+0x7dc5)[0x7fb195b1fdc5]                                                                       
/lib64/libc.so.6(clone+0x6d)[0x7fb19492a76d]
Andersbakken commented 7 years ago

Your clang is still compiled with assertions. This is something of a known issue. We should probably report it to the clang maintainers. I think you have to blow away your build directory and compile llvm/clang again and explicitly turning off assertions.

On Thu, Aug 24, 2017 at 4:36 AM, xinquanatcolezhu notifications@github.com wrote:

hi . i complied the clang without assertion. and get the following errors . your help is greatly appreicated.

that;s my emacs config

(use-package cmake-ide :bind (("" . cmake-ide-compile)) :config (progn (setq cmake-ide-rdm-executable "/usr/local/bin/rdm" cmake-ide-rc-executable "/usr/local/bin/rc" )))

(use-package rtags :config (progn (setq rtags-use-helm t) (setq rtags-autostart-diagnostics t) (rtags-diagnostics) (setq rtags-completions-enabled t) (push 'company-rtags company-backends) (add-hook 'c-mode-common-hook (lambda () (when (rtags-is-indexed) (local-set-key (kbd "M-'") 'rtags-find-symbol-at-point) (local-set-key (kbd "M-.") 'rtags-find-symbol) (local-set-key (kbd "M-@") 'rtags-find-references) (local-set-key (kbd "M-;") 'rtags-location-stack-back)))) (cmake-ide-setup)))

Running with 8 jobs, using args: -ferror-limit=50 -Wall -fspell-checking -Wno-unknown-warning-option Includepaths: "-isystem" /usr/local/lib/clang/4.0.0/include/ Restoring /home/AD/xinquan.zhu/oms/ ......... Restoring /home/AD/xinquan.zhu/bitsx/bitsx-lib/ ........ /usr/local/bin/rc -m --elisp rdm: /home/AD/xinquan.zhu/s/cfe-4.0.0.src/include/clang/Basic/SourceLocation.h:319: bool clang::FullSourceLoc::isBefo\ reInTranslationUnitThan(clang::FullSourceLoc) const: Assertion SrcMgr == Loc.SrcMgr && "Loc comes from another Sourc\ eManager!"' failed. libclang: crash detected during parsing: { 'source_filename' : '/home/AD/xinquan.zhu/oms/src/RedisAdaptor.cpp' 'command_line_args' : ['clang', '-std=c++14', '-Wall', '-c', '-DRTAGS=', '-DRTAGS=', '-I/tmp/cmake269826te/version/\ include', '-I/tmp/cmake269826te', '-I/home/AD/xinquan.zhu/oms/include', '-I/tmp/cmake269826te/tmp/include', '-I/usr/i\ nclude/mysql', '-isystem', '/usr/local/lib/clang/4.0.0/include/', '-isystem', '/usr/local/lib/clang/4.0.0/include/', \ '-o', '/tmp/cmake269826te/CMakeFiles/runUnitTests.dir/src/RedisAdaptor.cpp.o'], 'unsaved_files' : [], 'options' : 399, } *** Error in/usr/local/bin/rdm': corrupted double-linked list: 0x00007fb1843d6360 *** ======= Backtrace: ========= /lib64/libc.so.6(+0x7ada4)[0x7fb1948adda4] /lib64/libc.so.6(+0x7c595)[0x7fb1948af595] /usr/local/lib/libclang.so.4(+0x44328a)[0x7fb19648028a] /usr/local/lib/libclang.so.4(+0x435401)[0x7fb196472401] /usr/local/lib/libclang.so.4(+0x861cb1)[0x7fb19689ecb1] /usr/local/lib/libclang.so.4(+0x861e86)[0x7fb19689ee86] /usr/local/lib/libclang.so.4(+0x892aca)[0x7fb1968cfaca] /usr/local/lib/libclang.so.4(+0x1d03a29)[0x7fb197d40a29] /usr/local/lib/libclang.so.4(clang_parseTranslationUnit2FullArgv+0x48c)[0x7fb19645fe8d] /usr/local/lib/libclang.so.4(clang_parseTranslationUnit2+0xe0)[0x7fb19645f95f] /usr/local/bin/rdm(_ZN5RTags15TranslationUnit6createERK4PathRK4ListI6StringEP13CXUnsavedFilei5FlagsI23CXTranslationUn\ it_FlagsEb+0x65e)[0x48191e] /usr/local/bin/rdm(_ZN16CompletionThread7processEPNS_7RequestE+0x2350)[0x5949e0] /usr/local/bin/rdm(_ZN16CompletionThread3runEv+0x6d)[0x590c8d] /usr/local/bin/rdm(_ZN6Thread10localStartEPv+0x25)[0x54c425] /lib64/libpthread.so.0(+0x7dc5)[0x7fb195b1fdc5] /lib64/libc.so.6(clone+0x6d)[0x7fb19492a76d]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/1018#issuecomment-324610561, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEdSgvE-KuRyU47C_ihWsjBTnYNz2eJks5sbWA-gaJpZM4OvXtB .

xinquanatcolezhu commented 7 years ago

Actaully, I did redownloaded the llvm and clang and recmopiled them all again.

And my current llvm-config --assertion-mode tells me "OFF"

casch-at commented 6 years ago

Closing this issue, as it is very likely a clang problem!

Shooooooooo commented 5 years ago

Hi, sorry for bring this back up. I am also experiencing this issue on CentOS. (6.7) One interesting fact is that: if I start rdm with "--enable-compiler-manager", I got this crash. But if I put "--enable-compiler-manager" flag to .rdmrc, I no longer have this crash. I understand the previous reporter does not even have this flag in his config, but I just want to put this discovery here. Do we have a description of what this assertion failure complaining about?