[swift-users] Segmentation fault when running binary executable compiled from LLVM bitcode on Linux

Jeffrey W jeffreyw61 at gmail.com
Thu Sep 21 15:41:58 CDT 2017

Hi swift team,

I download the prebuilt swift 4.0 from here
try to do some work on the generated LLVM BC. However, I got a seg fault
when running the binary executable compiled from bitcode as shown below:

$ cat hello.swift
print("Hello World")
$ swiftc hello.swift -emit-bc -o hello.bc
$ clang++ hello.bc -c -o hello.o
$ swiftc hello.o -o hello
$ ./hello
Segmentation fault (core dumped)

It works fine if no bitcode file is involved here.

$ swiftc hello.swift -c -o hello.o
$ swiftc hello.o -o hello
$ ./hello
Hello World

I am running Ubuntu 14.04.3 (kernel 4.8.0). I also encountered the same seg
fault if I use the prebuilt swift 3.1.1

Is it the right way to compile the bitcode generated from swift? Or is it a
bug in swift ?

Thanks a lot in advance!

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170921/49caa8a5/attachment.html>

More information about the swift-users mailing list