<html>
    <head>
      <base href="http://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 --- - crash when emitting code for constant initializer"
   href="http://llvm.org/bugs/show_bug.cgi?id=18375">18375</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash when emitting code for constant initializer
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>MC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>consider:
$ cat b.ll
target datalayout = "e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
target triple = "i386-unknown-linux-gnu"

%struct.R = type { i32 }

@__executable_start = external global i8
@x = global i32 sub (i32 ptrtoint (i32* @x to i32), i32 ptrtoint (i8*
@__executable_start to i32)), align 4

compile with:
$ ~/llvm/build/bin/llc b.ll -o b.o -filetype=obj
llc: ~/llvm/src/lib/MC/MCAssembler.cpp:147: uint64_t
llvm::MCAsmLayout::getSymbolOffset(const llvm::MCSymbolData*) const: Assertion
`SD->getFragment() && "Invalid getOffset() on undefined symbol!"' failed.
0  llc             0x000000000184f4ef llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  llc             0x000000000184f776
2  llc             0x000000000184f1ba
3  libpthread.so.0 0x00007f1432b9fcb0
4  libc.so.6       0x00007f1431ff4425 gsignal + 53
5  libc.so.6       0x00007f1431ff7b8b abort + 379
6  libc.so.6       0x00007f1431fed0ee
7  libc.so.6       0x00007f1431fed192
8  llc             0x000000000175c231
llvm::MCAsmLayout::getSymbolOffset(llvm::MCSymbolData const*) const + 1027
9  llc             0x000000000174570a
10 llc             0x000000000175e7df
llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&, llvm::MCFragment&,
llvm::MCFixup const&) + 143
11 llc             0x000000000175ec9c llvm::MCAssembler::Finish() + 1206
12 llc             0x000000000178c049 llvm::MCObjectStreamer::FinishImpl() +
123
13 llc             0x000000000177bc5d llvm::MCELFStreamer::FinishImpl() + 71
14 llc             0x0000000001791aaa llvm::MCStreamer::Finish() + 118
15 llc             0x0000000000f17def
llvm::AsmPrinter::doFinalization(llvm::Module&) + 3175
16 llc             0x0000000001705182
llvm::FPPassManager::doFinalization(llvm::Module&) + 88
17 llc             0x0000000001705596
18 llc             0x00000000017059fc
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 254
19 llc             0x0000000001705c0f
llvm::legacy::PassManager::run(llvm::Module&) + 39
20 llc             0x0000000000892640
21 llc             0x000000000089165a main + 237
22 libc.so.6       0x00007f1431fdf76d __libc_start_main + 237
23 llc             0x0000000000890fa9</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>