<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 - The MacOS X linker crashes when inlining functions using LTO, there is a problem with debug info after inlining"
   href="https://bugs.llvm.org/show_bug.cgi?id=36791">36791</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The MacOS X linker crashes when inlining functions using LTO, there is a problem with debug info after inlining
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Keywords</th>
          <td>crash-on-invalid
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chris.schaf@verizon.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aprantl@apple.com, dblaikie@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20089" name="attach_20089" title="An intermediate file from running ld with -save-temps">attachment 20089</a> <a href="attachment.cgi?id=20089&action=edit" title="An intermediate file from running ld with -save-temps">[details]</a></span>
An intermediate file from running ld with -save-temps

I am attempting to inline compiled functions C++ functions into llvm-ir
generated by my Common Lisp compiler.   I am doing this on MacOS X using llvm
5.0

When I use LTO to link llvm-ir generated from C++ code with llvm-ir generated
by my Common Lisp compiler it crashes the linker.

I worked with joker-eph and chandlerc on IRC and they suggested I could run the
linker with -save-temps and then run the temporary files through opt and llc
and clang to find where the problem turns up.   I found the following...

clang -c 2.3.imported.bc -O2

Crashes with the following backtrace.

0  clang-5.0                0x0000000106e5f0a8
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  clang-5.0                0x0000000106e5e356 llvm::sys::RunSignalHandlers() +
86
2  clang-5.0                0x0000000106e5f60e SignalHandler(int) + 270
3  libsystem_platform.dylib 0x00007fffb6efcb3a _sigtramp + 26
4  libsystem_platform.dylib 0x00007fff59846c38 _sigtramp + 2727649560
5  clang-5.0                0x00000001073b5ada
llvm::DwarfDebug::finishVariableDefinitions() + 170
6  clang-5.0                0x00000001073b5c48
llvm::DwarfDebug::finalizeModuleInfo() + 168
7  clang-5.0                0x00000001073b601c llvm::DwarfDebug::endModule() +
44
8  clang-5.0                0x00000001073955c9
llvm::AsmPrinter::doFinalization(llvm::Module&) + 1017
9  clang-5.0                0x0000000106a4e373
llvm::FPPassManager::doFinalization(llvm::Module&) + 83
10 clang-5.0                0x0000000106a4e838
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1192
11 clang-5.0                0x0000000106fcf999
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions
const&, clang::CodeGenOptions const&, clang::TargetOptions const&,
clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*,
clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream,
std::__1::default_delete<llvm::raw_pwrite_stream> >) + 12185
12 clang-5.0                0x000000010715951f
clang::CodeGenAction::ExecuteAction() + 1071
13 clang-5.0                0x000000010734d7f3 clang::FrontendAction::Execute()
+ 67
14 clang-5.0                0x000000010730d708
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1112
15 clang-5.0                0x000000010738ebb7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 4007
16 clang-5.0                0x00000001063bb44f cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 1183
17 clang-5.0                0x00000001063b96e9 main + 10489
18 libdyld.dylib            0x00007fffb6ced235 start + 1
Stack dump:
0.      Program arguments:
/Users/meister/Development/externals-clasp/build/release/bin/clang-5.0 -cc1
-triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage
-Werror=deprecated-objc-isa-usage -emit-obj -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name 2.3.imported.bc
-mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
-masm-verbose -munwind-tables -faligned-alloc-unavailable -target-cpu penryn
-target-linker-version 305 -dwarf-column-info -debugger-tuning=lldb
-coverage-notes-file
/Users/meister/Development/cst-clasp/src/lisp/tests/ta.fasl.thinlto.bcs/2.3.imported.gcno
-resource-dir
/Users/meister/Development/externals-clasp/build/release/lib/clang/5.0.0 -O2
-fdebug-compilation-dir
/Users/meister/Development/cst-clasp/src/lisp/tests/ta.fasl.thinlto.bcs
-ferror-limit 19 -fmessage-length 220 -stack-protector 1 -fblocks
-fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature
-fmax-type-align=16 -fdiagnostics-show-option -vectorize-loops -vectorize-slp
-o 2.3.imported.o -x ir 2.3.imported.bc 
1.      Code generation
clang-5.0: error: unable to execute command: Segmentation fault: 11 (core
dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
8e4862b5be221092291aaf7ea40d72274acb9d96) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
0bc70c306ccbf483a029a25a6fd851bc332accff)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Users/meister/Development/externals-clasp/build/release/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.
meister@MacBook-Pro-7 ta.fasl.thinlto.bcs$</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>