[llvm-dev] LLVM Kaleidoscope : Compiling to Object Code - Segmentation Fault

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 24 12:17:36 PST 2019

Hi there!

Sorry to hear you're having trouble with the examples & thanks for reaching

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:

$ ./bin/Kaleidoscope-Ch8
ready> def average(x y) (x + y) * 0.5;
Read function definition:
define double @average(double %x, double %y) {
  %y2 = alloca double
  %x1 = alloca double
  store double %x, double* %x1
  store double %y, double* %y2
  %x3 = load double, double* %x1
  %y4 = load double, double* %y2
  %addtmp = fadd double %x3, %y4
  %multmp = fmul double %addtmp, 5.000000e-01
  ret double %multmp

Any  ideas what you might be doing differently that I could do to try to
reproduce the failure you're seeing?

On Thu, Jan 24, 2019 at 9:36 AM preejackie via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi all :)
> I'm new to llvm!
> 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.
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004afee0 in
> llvm::optional_detail::OptionalStorage<llvm::Reloc::Model,
> true>::OptionalStorage(llvm::optional_detail::OptionalStorage<llvm::Reloc::Model,
> true> const&) ()
> Source code:
> TargetOptions opt;
> auto RM = Optional<Reloc::Model>();
> auto TheTargetMachine =
> Target->createTargetMachine(TargetTriple, CPU, Features, opt, RM);
> 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.
> Of course, the kaleidoscope is friendly and good introduction to llvm for
> beginners, thank you very much for developing :)
> Thanks for your kind help
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190124/de66dfd3/attachment.html>

More information about the llvm-dev mailing list