<div dir="ltr">Hi there!<br><br>Sorry to hear you're having trouble with the examples & thanks for reaching out.<br><br>I'm having some difficulty reproducing the failure mode you described. From the code sample, it sounds like you're in Chapter 8 and I just took a look at Chapter 8 in my debug build and got this result:<br><br><div>$ ./bin/Kaleidoscope-Ch8 </div><div>ready> def average(x y) (x + y) * 0.5;</div><div>Read function definition:</div><div>define double @average(double %x, double %y) {</div><div>entry:</div><div> %y2 = alloca double</div><div> %x1 = alloca double</div><div> store double %x, double* %x1</div><div> store double %y, double* %y2</div><div> %x3 = load double, double* %x1</div><div> %y4 = load double, double* %y2</div><div> %addtmp = fadd double %x3, %y4</div><div> %multmp = fmul double %addtmp, 5.000000e-01</div><div> ret double %multmp</div><div>}</div><div><br><br>Any ideas what you might be doing differently that I could do to try to reproduce the failure you're seeing?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 24, 2019 at 9:36 AM preejackie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<p>Hi all :)</p>
<p>I'm new to llvm!<br>
</p>
<p>I'm going through the kaleidoscope : compiling llvm IR to object
code tutorial, code in the listings breaks and causes a
segmentation fault. After some investigation through gdb, probably
this constructor call, causing the segfault.<br>
</p>
<p><code>Program received signal SIGSEGV, Segmentation fault.</code><code><br>
</code><code>0x00000000004afee0 in
llvm::optional_detail::OptionalStorage<llvm::Reloc::Model,
true>::OptionalStorage(llvm::optional_detail::OptionalStorage<llvm::Reloc::Model,
true> const&) ()</code></p>
<p><code>Source code: </code><br>
</p>
<div style="color:#f8f8f2;background-color:#272822;font-family:'Droid Sans Mono','monospace',monospace,'Droid Sans Fallback';font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:#f8f8f2">TargetOptions opt;</span></div><div><font face="Courier New, Courier, monospace"><span style="color:#f8f8f2"> </span><span style="color:#66d9ef;font-style:italic">auto</span><span style="color:#f8f8f2"> RM </span><span style="color:#f92672">=</span><span style="color:#f8f8f2"> Optional</span><span style="color:#f92672"><</span><span style="color:#f8f8f2">Reloc::Model</span><span style="color:#f92672">></span><span style="color:#f8f8f2">();</span></font></div><div><span style="color:#f8f8f2"> </span><span style="color:#66d9ef;font-style:italic">auto</span><span style="color:#f8f8f2"> TheTargetMachine </span><span style="color:#f92672">=</span></div><div><span style="color:#f8f8f2"> Target-></span><span style="color:#a6e22e">createTargetMachine</span><span style="color:#f8f8f2">(TargetTriple, CPU, Features, opt, RM);</span></div></div>
<p>Whether this behavior is already notified and is there any
workaround available for it ? I would be great to know the root
cause for this behavior.<br>
</p>
<p>Of course, the kaleidoscope is friendly and good introduction to
llvm for beginners, thank you very much for developing :) <br>
</p>
<p>Thanks for your kind help <br>
</p>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>