[llvm-bugs] [Bug 34236] New: clang-format exits with assertion error on specific block comment

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 18 12:06:41 PDT 2017


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

            Bug ID: 34236
           Summary: clang-format exits with assertion error on specific
                    block comment
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: euhlmann at vmware.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Created attachment 19004
  --> https://bugs.llvm.org/attachment.cgi?id=19004&action=edit
The input that causes the error

With the following input (attached), clang-format exits with an assertion
error.

/*                                                                */ /*
 *       a a
 *       a     a*/


If any one character is removed, everything works fine, but this specific input
fails.
Error text:

Assertion failed: (PreviousOriginalWhitespaceEndOffset <=
OriginalWhitespaceStartOffset), function calculateLineBreakInformation, file
/Users/euhlmann/clang/llvm/tools/clang/lib/Format/WhitespaceManager.cpp, line
112.
0  clang-format             0x000000010a8768ac
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  clang-format             0x000000010a876e29
PrintStackTraceSignalHandler(void*) + 25
2  clang-format             0x000000010a872a09 llvm::sys::RunSignalHandlers() +
425
3  clang-format             0x000000010a877362 SignalHandler(int) + 354
4  libsystem_platform.dylib 0x00007fffa3f0eb3a _sigtramp + 26
5  libsystem_platform.dylib 0x01007f89a9600f50 _sigtramp + 91169840
6  libsystem_c.dylib        0x00007fffa3d93420 abort + 129
7  libsystem_c.dylib        0x00007fffa3d5a893 basename_r + 0
8  clang-format             0x000000010aa4b4c3
clang::format::WhitespaceManager::calculateLineBreakInformation() + 1187
9  clang-format             0x000000010aa4af9c
clang::format::WhitespaceManager::generateReplacements() + 172
10 clang-format             0x000000010a9c9595 clang::format::(anonymous
namespace)::Formatter::analyze(clang::format::TokenAnnotator&,
llvm::SmallVectorImpl<clang::format::AnnotatedLine*>&,
clang::format::FormatTokenLexer&) + 1077
11 clang-format             0x000000010a9f9c49
clang::format::TokenAnalyzer::process() + 1737
12 clang-format             0x000000010a9c9036
clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef,
llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef,
clang::format::FormattingAttemptStatus*)::$_6::operator()(clang::format::Environment
const&) const + 134
13 clang-format             0x000000010a9c8fa4 clang::tooling::Replacements
std::__1::__invoke_void_return_wrapper<clang::tooling::Replacements>::__call<clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, clang::format::FormattingAttemptStatus*)::$_6&,
clang::format::Environment
const&>(clang::format::reformat(clang::format::FormatStyle const&,
llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef,
clang::format::FormattingAttemptStatus*)::$_6&&&, clang::format::Environment
const&&&) + 84
14 clang-format             0x000000010a9c8f20
std::__1::__function::__func<clang::format::reformat(clang::format::FormatStyle
const&, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>,
llvm::StringRef, clang::format::FormattingAttemptStatus*)::$_6,
std::__1::allocator<clang::format::reformat(clang::format::FormatStyle const&,
llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef,
clang::format::FormattingAttemptStatus*)::$_6>, clang::tooling::Replacements
(clang::format::Environment const&)>::operator()(clang::format::Environment
const&) + 64
15 clang-format             0x000000010a991be2
std::__1::function<clang::tooling::Replacements (clang::format::Environment
const&)>::operator()(clang::format::Environment const&) const + 66
16 clang-format             0x000000010a990db9
clang::format::reformat(clang::format::FormatStyle const&, llvm::StringRef,
llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef,
clang::format::FormattingAttemptStatus*) + 1161
17 clang-format             0x000000010a723d23
clang::format::format(llvm::StringRef) + 6019
18 clang-format             0x000000010a721a17 main + 4455
19 libdyld.dylib            0x00007fffa3cff235 start + 1
Abort trap: 6

-- 
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/20170818/f742291c/attachment.html>


More information about the llvm-bugs mailing list