<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 - Trunk LTO gives internal error if object is compiled separately with clang -flto -c with a .bc file extension"
   href="https://bugs.llvm.org/show_bug.cgi?id=41570">41570</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Trunk LTO gives internal error if object is compiled separately with clang -flto -c with a .bc file extension
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>lto
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>peter.smith@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With a clang built this morning:
clang --version
clang version 9.0.0 (trunk 358996)
I get an error when I compile with -flto separately with a .bc suffix and then
attempt to invoke the code-generator. The reason for doing this is to work
around LTO not supporting -Os and -Oz
(<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [LTO] -Os and -Oz -flto results in error message from LTO code generator."
   href="show_bug.cgi?id=41568">https://bugs.llvm.org/show_bug.cgi?id=41568</a>). 

I couldn't reproduce with clang 7.0.0 but I could with clang 8.0.0 

cat main.c
int main(void) {
    return 0;
}

clang -flto -Os -c main.c -o main.bc
clang -flto main.bc -o main

module flag identifiers must be unique (or of 'require' type)
!"EnableSplitLTOUnit"
fatal error: error in backend: Broken module found, compilation aborted!
clang-6: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 9.0.0 (trunk 358996)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /linaro/upstream/buildclang/bin
clang-9: 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-9: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

This seems to only occur when the .bc file extension is used, it doesn't when
.o is used so this maybe expected behaviour, it did have me confused for some
time though.</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>