[llvm-bugs] [Bug 25072] New: clang-format segfault: <file> prefixed with ./

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 6 05:59:45 PDT 2015


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

            Bug ID: 25072
           Summary: clang-format segfault: <file> prefixed with ./
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mattipee at yahoo.co.uk
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org
    Classification: Unclassified

Segfault in Release, assertion hits in Debug


$ cat asdf.h
class A {};


Version 3.4
===========

$ /usr/bin/clang-format-3.4 asdf.h
Can't find usable .clang-format, using LLVM style
class A {};

$ /usr/bin/clang-format-3.4 ./asdf.h
Can't find usable .clang-format, using LLVM style
class A {};


Release build
=============

$ ~/clang/build-release/bin/clang-format -version
clang-format version 3.8.0 (http://llvm.org/git/clang.git
fad8a5cf2c6fe44b4f115952040f9dfdd23016da) (http://llvm.org/git/llvm.git
c06b5e8aab782a8117419c28f7660e062701307c)

$ ~/clang/build-release/bin/clang-format asdf.h
class A {};

$ ~/clang/build-release/bin/clang-format ./asdf.h
#0 0x41e968 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/majp/clang/build-release/bin/clang-format+0x41e968)
#1 0x41e136 llvm::sys::RunSignalHandlers()
(/home/majp/clang/build-release/bin/clang-format+0x41e136)
#2 0x41e335 SignalHandler(int)
(/home/majp/clang/build-release/bin/clang-format+0x41e335)
#3 0x7f36a5f2f340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x42fabc clang::SrcMgr::ContentCache::getSize() const
(/home/majp/clang/build-release/bin/clang-format+0x42fabc)
#5 0x4340fd clang::SourceManager::createFileID(clang::SrcMgr::ContentCache
const*, clang::SourceLocation, clang::SrcMgr::CharacteristicKind, int, unsigned
int) (/home/majp/clang/build-release/bin/clang-format+0x4340fd)
#6 0x44daea clang::format::reformat(clang::format::FormatStyle const&,
llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, bool*)
(/home/majp/clang/build-release/bin/clang-format+0x44daea)
#7 0x407d57 clang::format::format(llvm::StringRef)
(/home/majp/clang/build-release/bin/clang-format+0x407d57)
#8 0x403d57 main (/home/majp/clang/build-release/bin/clang-format+0x403d57)
#9 0x7f36a535bec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#10 0x405639 _start (/home/majp/clang/build-release/bin/clang-format+0x405639)
Segmentation fault


Debug build
===========

$ ~/clang/build-debug/bin/clang-format -version
clang-format version 3.8.0 (http://llvm.org/git/clang.git
fad8a5cf2c6fe44b4f115952040f9dfdd23016da) (http://llvm.org/git/llvm.git
c06b5e8aab782a8117419c28f7660e062701307c)

$ ~/clang/build-debug/bin/clang-format asdf.h 
class A {};

$ ~/clang/build-debug/bin/clang-format ./asdf.h 
clang-format:
/home/majp/clang/llvm/tools/clang/lib/Basic/SourceManager.cpp:422: const
clang::SrcMgr::ContentCache*
clang::SourceManager::getOrCreateContentCache(const clang::FileEntry*, bool):
Assertion `FileEnt && "Didn't specify a file entry to use?"' failed.
#0 0x4496b3 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/majp/clang/llvm/lib/Support/Unix/Signals.inc:405:0
#1 0x4499c8 PrintStackTraceSignalHandler(void*)
/home/majp/clang/llvm/lib/Support/Unix/Signals.inc:463:0
#2 0x44815a llvm::sys::RunSignalHandlers()
/home/majp/clang/llvm/lib/Support/Signals.cpp:34:0
#3 0x44859a SignalHandler(int)
/home/majp/clang/llvm/lib/Support/Unix/Signals.inc:211:0
#4 0x7f13c3518340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#5 0x7f13c2959cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x7f13c295d0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#7 0x7f13c2952b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#8 0x7f13c2952c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#9 0x48f478 clang::SourceManager::getOrCreateContentCache(clang::FileEntry
const*, bool)
/home/majp/clang/llvm/tools/clang/lib/Basic/SourceManager.cpp:425:0
#10 0x408657 clang::SourceManager::createFileID(clang::FileEntry const*,
clang::SourceLocation, clang::SrcMgr::CharacteristicKind, int, unsigned int)
/home/majp/clang/llvm/tools/clang/include/clang/Basic/SourceManager.h:768:0
#11 0x4cfef7 clang::format::reformat(clang::format::FormatStyle const&,
llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, llvm::StringRef, bool*)
/home/majp/clang/llvm/tools/clang/lib/Format/Format.cpp:1805:0
#12 0x4065de clang::format::format(llvm::StringRef)
/home/majp/clang/llvm/tools/clang/tools/clang-format/ClangFormat.cpp:260:0
#13 0x406f2f main
/home/majp/clang/llvm/tools/clang/tools/clang-format/ClangFormat.cpp:344:0
#14 0x7f13c2944ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#15 0x405169 _start (/home/majp/clang/build-debug/bin/clang-format+0x405169)
Aborted

-- 
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/20151006/469faad6/attachment.html>


More information about the llvm-bugs mailing list