[llvm-bugs] [Bug 32408] New: clang-format hits assertion in SourceManager.cpp:817:

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 24 08:07:11 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32408

            Bug ID: 32408
           Summary: clang-format hits assertion in SourceManager.cpp:817:
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: octoploid at yandex.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18166
  --> https://bugs.llvm.org/attachment.cgi?id=18166&action=edit
testcase

markus at x4 tmp % clang-format bench.ii
clang-format: /home/markus/llvm/tools/clang/lib/Basic/SourceManager.cpp:817:
clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const:
Assertion `0 && "Invalid SLoc
Offset or bad function choice"' failed.
#0 0x00007ff0cf9ef85a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/bin/../lib/libLLVMSupport.so.5+0x11585a)
#1 0x00007ff0cf9ed2e6 llvm::sys::RunSignalHandlers()
(/usr/local/bin/../lib/libLLVMSupport.so.5+0x1132e6)
#2 0x00007ff0cf9ed64a SignalHandler(int)
(/usr/local/bin/../lib/libLLVMSupport.so.5+0x11364a)
#3 0x00007ff0cf60c3b0 __restore_rt (/lib/libpthread.so.0+0x123b0)
#4 0x00007ff0ceaf82ee __GI_raise
/home/markus/glibc/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007ff0ceaf9f00 __GI_abort /home/markus/glibc/stdlib/abort.c:91:0
#6 0x00007ff0ceaf07bc __assert_fail_base
/home/markus/glibc/assert/assert.c:89:0
#7 0x00007ff0ceaf0842 (/lib/libc.so.6+0x2e842)
#8 0x00007ff0cf475a7e (/usr/local/bin/../lib/libclangBasic.so.5+0x140a7e)
#9 0x00007ff0cf475b9a
clang::SourceManager::getDecomposedLoc(clang::SourceLocation) const
(/usr/local/bin/../lib/libclangBasic.so.5+0x140b9a)
#10 0x00007ff0cf47f5d2
clang::SourceManager::isBeforeInTranslationUnit(clang::SourceLocation,
clang::SourceLocation) const
(/usr/local/bin/../lib/libclangBasic.so.5+0x14a5d2)
#11 0x00007ff0cf2bcf0d
clang::format::AffectedRangeManager::affectsCharSourceRange(clang::CharSourceRange
const&) (/usr/local/bin/../lib/libclangFormat.so.5+0x12f0d)
#12 0x00007ff0cf2bcfef
clang::format::AffectedRangeManager::affectsLeadingEmptyLines(clang::format::FormatToken
const&) (/usr/local/bin/../lib/libclangFormat.so.5+0x12fef)
#13 0x00007ff0cf2bd212
clang::format::AffectedRangeManager::computeAffectedLines(clang::format::AnnotatedLine**,
clang::format::AnnotatedLine**) (/usr/local/bin/../lib/libclangFor
mat.so.5+0x13212)
#14 0x00007ff0cf2cefcd clang::format::(anonymous
namespace)::Formatter::analyze(clang::format::TokenAnnotator&,
llvm::SmallVectorImpl<clang::format::AnnotatedLine*>&, clang::forma
t::FormatTokenLexer&) (/usr/local/bin/../lib/libclangFormat.so.5+0x24fcd)
#15 0x00007ff0cf2f4d23 clang::format::TokenAnalyzer::process()
(/usr/local/bin/../lib/libclangFormat.so.5+0x4ad23)
#16 0x00007ff0cf2ce711 clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, bool*)::{lambda(clang::f
ormat::TokenAnalyzer&)#1}::operator()(clang::format::TokenAnalyzer&) const
(/usr/local/bin/../lib/libclangFormat.so.5+0x24711)
#17 0x00007ff0cf2ceb77 clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, bool*) (/usr/local/bin/.
./lib/libclangFormat.so.5+0x24b77)
#18 0x0000000000408e11 (clang-format+0x408e11)
#19 0x000000000040492b (clang-format+0x40492b)
#20 0x00007ff0ceae2490 __libc_start_main
/home/markus/glibc/csu/../csu/libc-start.c:329:0
#21 0x00000000004049fa (clang-format+0x4049fa)
[1]    1279 abort      clang-format bench.ii

valgrind shows:

==115872== Conditional jump or move depends on uninitialised value(s)
==115872==    at 0x4193B08:
std::local_Rb_tree_decrement(std::_Rb_tree_node_base*) (tree.cc:97)
==115872==    by 0x1018F757: std::_Rb_tree_const_iterator<int>::operator--()
(stl_tree.h:380)
==115872==    by 0x10229AA7:
std::reverse_iterator<std::_Rb_tree_const_iterator<clang::tooling::Replacement>
>::operator->() const (stl_iterator.h:181)
==115872==    by 0x10226653:
clang::tooling::applyAllReplacements[abi:cxx11](llvm::StringRef,
clang::tooling::Replacements const&) (Replacement.cpp:572)
==115872==    by 0x1016CE47: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef,
bool*)::{lambda(clang::format::TokenAnalyzer&)#1}::operator()(clang::format::TokenAnalyzer&)
const (Format.cpp:1844)
==115872==    by 0x1016D2B3: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, bool*) (Format.cpp:1860)
==115872==    by 0x1000768F: clang::format::format(llvm::StringRef)
(ClangFormat.cpp:281)
==115872==    by 0x10008263: main (ClangFormat.cpp:367)
==115872== 
==115872== Conditional jump or move depends on uninitialised value(s)
==115872==    at 0x4193B08:
std::local_Rb_tree_decrement(std::_Rb_tree_node_base*) (tree.cc:97)
==115872==    by 0x1018F757: std::_Rb_tree_const_iterator<int>::operator--()
(stl_tree.h:380)
==115872==    by 0x10229AA7:
std::reverse_iterator<std::_Rb_tree_const_iterator<clang::tooling::Replacement>
>::operator->() const (stl_iterator.h:181)
==115872==    by 0x1022667B:
clang::tooling::applyAllReplacements[abi:cxx11](llvm::StringRef,
clang::tooling::Replacements const&) (Replacement.cpp:572)
==115872==    by 0x1016CE47: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef,
bool*)::{lambda(clang::format::TokenAnalyzer&)#1}::operator()(clang::format::TokenAnalyzer&)
const (Format.cpp:1844)
==115872==    by 0x1016D2B3: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, bool*) (Format.cpp:1860)
==115872==    by 0x1000768F: clang::format::format(llvm::StringRef)
(ClangFormat.cpp:281)
==115872==    by 0x10008263: main (ClangFormat.cpp:367)
==115872== 
==115872== Conditional jump or move depends on uninitialised value(s)
==115872==    at 0x4193B08:
std::local_Rb_tree_decrement(std::_Rb_tree_node_base*) (tree.cc:97)
==115872==    by 0x1018F757: std::_Rb_tree_const_iterator<int>::operator--()
(stl_tree.h:380)
==115872==    by 0x10229AA7:
std::reverse_iterator<std::_Rb_tree_const_iterator<clang::tooling::Replacement>
>::operator->() const (stl_iterator.h:181)
==115872==    by 0x102266A3:
clang::tooling::applyAllReplacements[abi:cxx11](llvm::StringRef,
clang::tooling::Replacements const&) (Replacement.cpp:572)
==115872==    by 0x1016CE47: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef,
bool*)::{lambda(clang::format::TokenAnalyzer&)#1}::operator()(clang::format::TokenAnalyzer&)
const (Format.cpp:1844)
==115872==    by 0x1016D2B3: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, bool*) (Format.cpp:1860)
==115872==    by 0x1000768F: clang::format::format(llvm::StringRef)
(ClangFormat.cpp:281)
==115872==    by 0x10008263: main (ClangFormat.cpp:367)
==115872== 
==115872== Conditional jump or move depends on uninitialised value(s)
==115872==    at 0x4193B08:
std::local_Rb_tree_decrement(std::_Rb_tree_node_base*) (tree.cc:97)
==115872==    by 0x1018F757: std::_Rb_tree_const_iterator<int>::operator--()
(stl_tree.h:380)
==115872==    by 0x1022679B:
clang::tooling::applyAllReplacements[abi:cxx11](llvm::StringRef,
clang::tooling::Replacements const&) (Replacement.cpp:570)
==115872==    by 0x1016CE47: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef,
bool*)::{lambda(clang::format::TokenAnalyzer&)#1}::operator()(clang::format::TokenAnalyzer&)
const (Format.cpp:1844)
==115872==    by 0x1016D2B3: clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, bool*) (Format.cpp:1860)
==115872==    by 0x1000768F: clang::format::format(llvm::StringRef)
(ClangFormat.cpp:281)
==115872==    by 0x10008263: main (ClangFormat.cpp:367)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170324/43fd5605/attachment-0001.html>


More information about the llvm-bugs mailing list