Closed hberntsen closed 10 years ago
The type used with C.Null needs to be a pointer type - e.g. C.Null (PointerType (IntegerType 32) 0). You might consider using a build of llvm with asserts turned on, at least for development. It'll give you informative messages in some cases like this, rather than just dying.
Thanks for you quick response. That indeed solves my problem. I did not expect a segmentation fault with the wrong AST, apparently that is how LLVM works. Makes sense though, all the assertions decrease compiling speed.
When you add the following code to llvm-general/test/LLVM/General/Test/Instructions.hs in the list of tests, the tests will crash with a segmentation fault:
(I am using version v3.4.2.2 with LLVM 3.4 on Ubuntu 14.04) I wanted to try the trick described at http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt to let llvm calculate sizes in my compiler. I tested with GHC 7.8.2 and 7.6.3 and both give a segmentation fault for this test.
gdb tells:
When using (ArrayType 2 (PointerType (IntegerType 32) (AddrSpace 0)):