<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 - Segmentation fault if more than 5 PCH-files are included"
   href="https://bugs.llvm.org/show_bug.cgi?id=37167">37167</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segmentation fault if more than 5 PCH-files are included
          </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>normal
          </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>simeonehrig@web.de
          </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=20198" name="attach_20198" title="preprocessed source code and makefile">attachment 20198</a> <a href="attachment.cgi?id=20198&action=edit" title="preprocessed source code and makefile">[details]</a></span>
preprocessed source code and makefile

I want to compile source files to PCH files recursively and finally to an
executable. Every new PCH file should contains his previous PCH-file, if it
exists. For example, if I have 3 source files, I would do the following steps:

clang++ -Xclang -emit-pch kernel1.hpp -o kernel1.hpp.pch
clang++ -Xclang -emit-pch kernel2.hpp -o kernel2.hpp.pch -include-pch
kernel1.hpp.pch
clang++ -Xclang -emit-pch kernel3.hpp -o kernel3.hpp.pch -include-pch
kernel2.hpp.pch 

clang++ main.cpp -include-pch myInclude/kernel3.hpp.pch -o main

If I generate 5 or less PCH files all is fine. If I want to generate 6 PCH
files, I get an Segmentation fault:

Stack dump:
0.      Program arguments: /usr/lib/llvm-7/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name main.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
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-7/lib/clang/7.0.0 -include-pch myInclude/kernel6.hpp.pch
-I/usr/lib/llvm-7/include -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8.0.1/../../../../include/c++/8.0.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8.0.1/../../../../include/x86_64-linux-gnu/c++/8.0.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8.0.1/../../../../include/x86_64-linux-gnu/c++/8.0.1
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/8.0.1/../../../../include/c++/8.0.1/backward
-internal-isystem /usr/include/clang/7.0.0/include/ -internal-isystem
/usr/local/include -internal-isystem /usr/lib/llvm-7/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir
/home/simeon/Programmieren/clang-dev/bugs/pch_include_bug -ferror-limit 19
-fmessage-length 211 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/main-ca9adb.o -x c++
main.cpp 
#0 0x00007f1dc079208a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/llvm-7/lib/libLLVM-7.so.1+0x88208a)
#1 0x00007f1dc0790306 llvm::sys::RunSignalHandlers()
(/usr/lib/llvm-7/lib/libLLVM-7.so.1+0x880306)
#2 0x00007f1dc079043b (/usr/lib/llvm-7/lib/libLLVM-7.so.1+0x88043b)
#3 0x00007f1dc3bd4890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00005586238494a4
clang::ASTReader::getLocalModuleFile(clang::serialization::ModuleFile&,
unsigned int) (/usr/lib/llvm-7/bin/clang+0x12284a4)
#5 0x000055862388d2bb
clang::ASTReader::loadDeclUpdateRecords(clang::ASTReader::PendingUpdateRecord&)
(/usr/lib/llvm-7/bin/clang+0x126c2bb)
#6 0x0000558623852d91 clang::ASTReader::finishPendingActions()
(/usr/lib/llvm-7/bin/clang+0x1231d91)
#7 0x0000558623854385 clang::ASTReader::FinishedDeserializing()
(/usr/lib/llvm-7/bin/clang+0x1233385)
#8 0x0000558623862dd7 clang::ASTReader::ReadAST(llvm::StringRef,
clang::serialization::ModuleKind, clang::SourceLocation, unsigned int,
llvm::SmallVectorImpl<clang::ASTReader::ImportedSubmodule>*)
(/usr/lib/llvm-7/bin/clang+0x1241dd7)
#9 0x0000558622ed0f00
clang::CompilerInstance::createPCHExternalASTSource(llvm::StringRef,
llvm::StringRef, bool, bool, clang::Preprocessor&, clang::ASTContext&,
clang::PCHContainerReader const&,
llvm::ArrayRef<std::shared_ptr<clang::ModuleFileExtension> >,
clang::DependencyFileGenerator*,
llvm::ArrayRef<std::shared_ptr<clang::DependencyCollector> >, void*, bool,
bool, bool) (/usr/lib/llvm-7/bin/clang+0x8aff00)
#10 0x0000558622ed6dc3
clang::CompilerInstance::createPCHExternalASTSource(llvm::StringRef, bool,
bool, void*, bool) (/usr/lib/llvm-7/bin/clang+0x8b5dc3)
#11 0x0000558622f142ba
clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&,
clang::FrontendInputFile const&) (/usr/lib/llvm-7/bin/clang+0x8f32ba)
#12 0x0000558622ed6140
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-7/bin/clang+0x8b5140)
#13 0x0000558622fb96eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-7/bin/clang+0x9986eb)
#14 0x0000558622a9da08 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-7/bin/clang+0x47ca08)
#15 0x0000558622a8ba7e main (/usr/lib/llvm-7/bin/clang+0x46aa7e)
#16 0x00007f1dbefcab97 __libc_start_main
/build/glibc-negH51/glibc-2.27/csu/../csu/libc-start.c:344:0
#17 0x0000558622a9b2ea _start (/usr/lib/llvm-7/bin/clang+0x47a2ea)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)</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>