<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Broken module (piece is larger than or outside of variable) with -g and -flto"
   href="https://llvm.org/bugs/show_bug.cgi?id=24923">24923</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Broken module (piece is larger than or outside of variable) with -g and -flto
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>russell_gallop@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following example has an ODR violation. It compiles okay without -flto or
without -g but with both a broken module is reported.

$ clang --version
clang version 3.8.0 (trunk 248463) (llvm/trunk 248476)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ cat a.cpp
struct P {};
void foo() { P l; }
$ cat b.cpp
struct P {
  int a;
  int b;
};
P fn1() {
  P r;
  r.a = 0;
  return r;
}
$ cat test.sh
#!/bin/bash -e
clang -O2 -g -flto $1 -c -o a.o
clang -O2 -g -flto $2 -c -o b.o
llvm-lto a.o b.o
$ ./test.sh a.cpp b.cpp
piece is larger than or outside of variable
  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !24, metadata
!32), !dbg !31
!24 = !DILocalVariable(name: "r", scope: !20, file: !12, line: 6, type:
!"_ZTS1P")
!32 = !DIExpression(DW_OP_bit_piece, 0, 32)
LLVM ERROR: Broken module found, compilation aborted!</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>