<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-format hits assertion in SourceManager.cpp:817:"
href="https://bugs.llvm.org/show_bug.cgi?id=32408">32408</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format hits assertion in SourceManager.cpp:817:
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>octoploid@yandex.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=18166" name="attach_18166" title="testcase">attachment 18166</a> <a href="attachment.cgi?id=18166&action=edit" title="testcase">[details]</a></span>
testcase
markus@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>
<span class="quote">>::operator->() const (stl_iterator.h:181)</span >
==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>
<span class="quote">>::operator->() const (stl_iterator.h:181)</span >
==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>
<span class="quote">>::operator->() const (stl_iterator.h:181)</span >
==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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>