<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div>I'm really a novice in experimenting with LLVM, so I might be doing something plain wrong here, but I can't understand why this snippet</div><div><br></div><div>// File ticket.cpp</div><div>struct ticket</div><div>{ </div><div><span class="Apple-tab-span" style="white-space:pre">     </span>int field1;</div><div><span class="Apple-tab-span" style="white-space:pre">  </span>char field2[10];</div><div>} _ticket;</div><div><br></div><div>goes fine through the sequence</div><div><br></div><div>1) clang++ -O0 -S -emit-llvm ticket.cpp (which generates ticket.s)</div><div>2) llc -march=cpp ticket.s</div><div><br></div><div>So that I end up with a ticket.s.cpp that I can inspect to learn more about how to define structures in LLVM IR, while the following:</div><div><br></div><div><br></div><div>//File ticket_stl.cpp</div><div>#include <vector></div><div><br></div><div>struct ticket_stl</div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>int field1;</div><div><span class="Apple-tab-span" style="white-space:pre">  </span>std::vector<int> field2;</div><div>} _ticket_stl;</div><div><br></div><div><br></div><div>Fails during step 2) (llc -march=cpp ticket_stl.s) with a laconic:</div><div><br></div><div><span class="Apple-style-span" style="font-family: Times; "><pre><span>LLVM ERROR: Invalid instruction
</span></pre><div><span><br></span></div></span>Everything works if I instead perform step 1) with -O1. </div><div>For what it's worth, the online compiler at <a href="http://llvm.org/demo/index.cgi">http://llvm.org/demo/index.cgi</a>, targeting "LLVM C++ API code", exhibits the same behavior (i.e. it fails at optimization level "None").</div><div><br></div><div>Is this known/expected behavior?</div><div><br></div><div>Andrea.</div><div><br></div></body></html>