[llvm-bugs] [Bug 31944] New: [PCH] Clang crashes when precompile header file with #line directive.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 13 04:31:20 PST 2017


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

            Bug ID: 31944
           Summary: [PCH] Clang crashes when precompile header file with
                    #line directive.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: amjad.aboud at intel.com
                CC: llvm-bugs at lists.llvm.org

GCC compiles this file correctly, while Clang crashes.

header.h:
  #line 1

  $ clang -x c-header header.h


0  clang-3.9       0x00000000019e6eb8
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 56
1  clang-3.9       0x00000000019e4e8e llvm::sys::RunSignalHandlers() + 62
2  clang-3.9       0x00000000019e4fdc
3  libpthread.so.0 0x00007f0b4334e390
4  clang-3.9       0x00000000024f7c18
clang::ASTWriter::WriteSourceManagerBlock(clang::SourceManager&,
clang::Preprocessor const&) + 6344
5  clang-3.9       0x000000000251ac51
clang::ASTWriter::WriteASTCore(clang::Sema&, llvm::StringRef,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, clang::Module*) + 6737
6  clang-3.9       0x000000000251bb9c clang::ASTWriter::WriteAST(clang::Sema&,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, clang::Module*, llvm::StringRef, bool) + 268
7  clang-3.9       0x000000000253a16d
clang::PCHGenerator::HandleTranslationUnit(clang::ASTContext&) + 93
8  clang-3.9       0x0000000001e65c18
clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&) + 40
9  clang-3.9       0x00000000023c9efa clang::ParseAST(clang::Sema&, bool, bool)
+ 938
10 clang-3.9       0x0000000001e3d83e clang::FrontendAction::Execute() + 286
11 clang-3.9       0x0000000001e0eed6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 278
12 clang-3.9       0x0000000001ebda73
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2195
13 clang-3.9       0x0000000000927048 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2248
14 clang-3.9       0x00000000008c321a main + 6682
15 libc.so.6       0x00007f0b422cc830 __libc_start_main + 240
16 clang-3.9       0x0000000000925039 _start + 41
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-3.9.1/bin/clang-3.9
-cc1 -triple x86_64-unknown-linux-gnu -emit-pch -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name example.cpp
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -mllvm -x86-asm-syntax=intel -dwarf-column-info
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-file
/tmp/compiler-explorer-compiler117113-29160-rkr7bj.kluarr7ldi/output.s
-resource-dir /opt/compiler-explorer/clang-3.9.1/bin/../lib/clang/3.9.1
-c-isystem /usr/include/x86_64-linux-gnu -cxx-isystem
/usr/include/x86_64-linux-gnu -internal-isystem /usr/local/include
-internal-isystem
/opt/compiler-explorer/clang-3.9.1/bin/../lib/clang/3.9.1/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /compiler-explorer -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fdiagnostics-show-option -o
/tmp/compiler-explorer-compiler117113-29160-rkr7bj.kluarr7ldi/output.s -x
c-header <source>
1.      <eof> parser at end of file
clang-3.9: error: unable to execute command: Segmentation fault (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.1 (tags/RELEASE_391/final 291579)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-3.9.1/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.9: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.9: note: diagnostic msg: /tmp/example-85981e.h
clang-3.9: note: diagnostic msg: /tmp/example-85981e.sh
clang-3.9: note: diagnostic msg:
********************
Compiler exited with result code 254

-- 
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/20170213/b30285ae/attachment.html>


More information about the llvm-bugs mailing list