Closed stepancheg closed 12 years ago
I'm unable to replicate this on Linux x86_64.
@agemogolk Do you have valgrind? Try running the compiler in valgrind and see if a memory error crops up.
Valgrind just shows up a couple of "Conditional jump or move depends on uninitialised value" errors.
The backtrace looks like it may point to something in the llvm backend, mac specific maybe?
"Conditional jump or move depends on uninitialised value" sounds like a real problem. Where do those come up?
==23661== Conditional jump or move depends on uninitialised value(s)
==23661== at 0x4017876: index (in /usr/lib/ld-2.16.so)
==23661== by 0x4007902: expand_dynamic_string_token (in /usr/lib/ld-2.16.so)
==23661== by 0x4008204: _dl_map_object (in /usr/lib/ld-2.16.so)
==23661== by 0x400180D: map_doit (in /usr/lib/ld-2.16.so)
==23661== by 0x400E785: _dl_catch_error (in /usr/lib/ld-2.16.so)
==23661== by 0x40010DB: do_preload (in /usr/lib/ld-2.16.so)
==23661== by 0x4004546: dl_main (in /usr/lib/ld-2.16.so)
==23661== by 0x4014B5D: _dl_sysdep_start (in /usr/lib/ld-2.16.so)
==23661== by 0x4004DFD: _dl_start (in /usr/lib/ld-2.16.so)
==23661== by 0x4001627: ??? (in /usr/lib/ld-2.16.so)
==23661== by 0x1: ???
==23661== by 0x7FF0007DE: ???
==23661== Uninitialised value was created by a stack allocation
==23661== at 0x40044CB: dl_main (in /usr/lib/ld-2.16.so)
==23661==
==23661== Conditional jump or move depends on uninitialised value(s)
==23661== at 0x401787B: index (in /usr/lib/ld-2.16.so)
==23661== by 0x4007902: expand_dynamic_string_token (in /usr/lib/ld-2.16.so)
==23661== by 0x4008204: _dl_map_object (in /usr/lib/ld-2.16.so)
==23661== by 0x400180D: map_doit (in /usr/lib/ld-2.16.so)
==23661== by 0x400E785: _dl_catch_error (in /usr/lib/ld-2.16.so)
==23661== by 0x40010DB: do_preload (in /usr/lib/ld-2.16.so)
==23661== by 0x4004546: dl_main (in /usr/lib/ld-2.16.so)
==23661== by 0x4014B5D: _dl_sysdep_start (in /usr/lib/ld-2.16.so)
==23661== by 0x4004DFD: _dl_start (in /usr/lib/ld-2.16.so)
==23661== by 0x4001627: ??? (in /usr/lib/ld-2.16.so)
==23661== by 0x1: ???
==23661== by 0x7FF0007DE: ???
==23661== Uninitialised value was created by a stack allocation
==23661== at 0x40044CB: dl_main (in /usr/lib/ld-2.16.so)
@stepancheg @agemogolk Is your LLVM built as Debug or Release? With or without assertions?
Standard Arch install at the moment. Optimized build with assertions disabled.
./configure \ --prefix=/usr \ --libdir=/usr/lib/llvm \ --sysconfdir=/etc \ --enable-shared \ --enable-libffi \ --enable-targets=all \ --disable-expensive-checks \ --disable-debug-runtime \ --disable-assertions \ --with-binutils-include=/usr/include \ --$_optimized_switch-optimized
If it's an LLVM-level problem building with assertions enabled might help reveal more information.
Apparently the valgrind errors I posted above are due to a version mismatch with ld. After upgrading valgrind to latest they no longer appear. I'll see if I get a different result with latest llvm with assertions enabled.
If I'm using LLVM compiled with debug, I cannot reproduce original problem, but I get another similar crash, also only when debugging enabled. Command line:
./compiler/src/clay -arch x86_64 -Mprinter -g -e ''
Assertion failed: (RTy.Verify() && "Unable to create reference type"), function createReferenceType, file /Users/yozh/devel/left/llvm-3.1.src/lib/Analysis/DIBuilder.cpp, line 234.
signal 6!
compilation context:
Exception(Exception)
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/exceptions/exceptions.clay(50,38):
allocateObject(Exception)
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/exceptions/exceptions.clay(50,28):
throwValue(Exception)
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/memory/memory.clay(292,8):
eachLocationWithCleanup(Pointer[Pointer[UInt8]], Pointer[Pointer[UInt8]], Static[initialize])
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/memory/memory.clay(119,27):
initializeMemory(Pointer[Pointer[UInt8]], Pointer[Pointer[UInt8]])
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/arrays/arrays.clay(176,20):
Array[Pointer[UInt8], 128]()
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/errors/backtrace/backtrace.macosx.clay(5,41):
showBacktrace()
/Users/yozh/devel/left/clay/build-debug/compiler/src/../../../lib-clay/core/exceptions/exceptions.clay(106,17):
errorMsg(Static["exception when initializing globals\n"])
Assertion failed: (RTy.Verify() && "Unable to create reference type"), function createReferenceType, file /Users/yozh/devel/left/llvm-3.1.src/lib/Analysis/DIBuilder.cpp, line 234.
Program received signal SIGABRT, Aborted.
0x00007fff8e08f212 in __pthread_kill ()
(gdb) where
#0 0x00007fff8e08f212 in __pthread_kill ()
#1 0x00007fff8d788b34 in pthread_kill ()
#2 0x00000001011fd81b in raise (sig=6) at Signals.inc:301
#3 0x00000001011fd8d2 in abort () at Signals.inc:318
#4 0x00000001011fd8b1 in __assert_rtn (func=0x10132a3c5 "createReferenceType", file=0x10132a081 "/Users/yozh/devel/left/llvm-3.1.src/lib/Analysis/DIBuilder.cpp", line=234, expr=0x10132a3d9 "RTy.Verify() && \"Unable to create reference type\"") at Signals.inc:314
#5 0x0000000100eb387a in llvm::DIBuilder::createReferenceType (this=0x103204320, RTy=@0x7fff5fbc54f8) at DIBuilder.cpp:234
#6 0x00000001000b9f20 in clay::codegenBinding (x=@0x7fff5fbc5970, env=@0x7fff5fbc5968, ctx=0x7fff5fbc8750) at codegen.cpp:4195
#7 0x00000001000b58d8 in codegenBlockStatement (block=@0x7fff5fbc7240, i=4, stmt=@0x7fff5fbc7238, env=@0x7fff5fbc7ca8, ctx=0x7fff5fbc8750, terminated=@0x7fff5fbc724f) at codegen.cpp:3510
#8 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbc7cb0, env=@0x7fff5fbc7ca8, ctx=0x7fff5fbc8750) at codegen.cpp:3597
#9 0x00000001000b189d in clay::codegenCodeBody (entry=0x1039311b0) at codegen.cpp:3131
#10 0x00000001000a6e39 in clay::codegenCallCode (entry=0x1039311b0, args=@0x7fff5fbc8d58, ctx=0x7fff5fbd7210, out=@0x7fff5fbc8d50) at codegen.cpp:2460
#11 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbc9770, args=@0x7fff5fbc9768, env=@0x7fff5fbc9760, ctx=0x7fff5fbd7210, out=@0x7fff5fbc9758) at codegen.cpp:2080
#12 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbc9da0, env=@0x7fff5fbc9d98, ctx=0x7fff5fbd7210, out=@0x7fff5fbc9d90) at codegen.cpp:1044
#13 0x000000010007a16f in clay::codegenExpr (expr=@0x7fff5fbcab58, env=@0x7fff5fbcab50, ctx=0x7fff5fbd7210, out=@0x7fff5fbcab48) at codegen.cpp:1177
#14 0x0000000100077938 in clay::codegenExpr (expr=@0x7fff5fbcae48, env=@0x7fff5fbcae40, ctx=0x7fff5fbd7210, out=@0x7fff5fbcae38) at codegen.cpp:1011
#15 0x00000001000768c1 in clay::codegenExprInto (expr=@0x7fff5fbcb268, env=@0x7fff5fbcb260, ctx=0x7fff5fbd7210, out=@0x7fff5fbcb258) at codegen.cpp:856
#16 0x0000000100075189 in clay::codegenMultiInto (exprs=@0x7fff5fbcc8e8, env=@0x7fff5fbcc8e0, ctx=0x7fff5fbd7210, out=@0x7fff5fbcc8d8, wantCount=1) at codegen.cpp:796
#17 0x0000000100069a8b in clay::codegenStatement (stmt=@0x7fff5fbccc10, env=@0x7fff5fbccc08, ctx=0x7fff5fbd7210) at codegen.cpp:3690
#18 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbce540, i=0, stmt=@0x7fff5fbce538, env=@0x7fff5fbcf408, ctx=0x7fff5fbd7210, terminated=@0x7fff5fbce54f) at codegen.cpp:3521
#19 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbcf410, env=@0x7fff5fbcf408, ctx=0x7fff5fbd7210) at codegen.cpp:3597
#20 0x000000010006ed59 in clay::codegenStatement (stmt=@0x7fff5fbcfed0, env=@0x7fff5fbcfec8, ctx=0x7fff5fbd7210) at codegen.cpp:3990
#21 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbd1800, i=1, stmt=@0x7fff5fbd17f8, env=@0x7fff5fbd1b70, ctx=0x7fff5fbd7210, terminated=@0x7fff5fbd180f) at codegen.cpp:3521
#22 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbd1b78, env=@0x7fff5fbd1b70, ctx=0x7fff5fbd7210) at codegen.cpp:3597
#23 0x00000001000a6a07 in clay::codegenCallByName (entry=0x103931318, callable=@0x7fff5fbd1f40, args=@0x7fff5fbd1f38, env=@0x7fff5fbd1f30, ctx=0x7fff5fbd7210, out=@0x7fff5fbd1f28) at codegen.cpp:3455
#24 0x000000010007fec4 in clay::codegenCallExpr (callable=@0x7fff5fbd2920, args=@0x7fff5fbd2918, env=@0x7fff5fbd2910, ctx=0x7fff5fbd7210, out=@0x7fff5fbd2908) at codegen.cpp:2075
#25 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbd2cd8, env=@0x7fff5fbd2cd0, ctx=0x7fff5fbd7210, out=@0x7fff5fbd2cc8) at codegen.cpp:1044
#26 0x00000001000768c1 in clay::codegenExprInto (expr=@0x7fff5fbd30f8, env=@0x7fff5fbd30f0, ctx=0x7fff5fbd7210, out=@0x7fff5fbd30e8) at codegen.cpp:856
#27 0x0000000100075189 in clay::codegenMultiInto (exprs=@0x7fff5fbd4240, env=@0x7fff5fbd4238, ctx=0x7fff5fbd7210, out=@0x7fff5fbd4230, wantCount=1) at codegen.cpp:796
#28 0x00000001000b8c3d in clay::codegenBinding (x=@0x7fff5fbd4430, env=@0x7fff5fbd4428, ctx=0x7fff5fbd7210) at codegen.cpp:4145
#29 0x00000001000b58d8 in codegenBlockStatement (block=@0x7fff5fbd5d00, i=0, stmt=@0x7fff5fbd5cf8, env=@0x7fff5fbd6768, ctx=0x7fff5fbd7210, terminated=@0x7fff5fbd5d0f) at codegen.cpp:3510
#30 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbd6770, env=@0x7fff5fbd6768, ctx=0x7fff5fbd7210) at codegen.cpp:3597
#31 0x00000001000b189d in clay::codegenCodeBody (entry=0x10392d220) at codegen.cpp:3131
#32 0x00000001000a6e39 in clay::codegenCallCode (entry=0x10392d220, args=@0x7fff5fbd7818, ctx=0x7fff5fbe2960, out=@0x7fff5fbd7810) at codegen.cpp:2460
#33 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbd88d0, args=@0x7fff5fbd88c8, env=@0x7fff5fbd88c0, ctx=0x7fff5fbe2960, out=@0x7fff5fbd88b8) at codegen.cpp:2080
#34 0x000000010006f267 in clay::codegenStatement (stmt=@0x7fff5fbd9420, env=@0x7fff5fbd9418, ctx=0x7fff5fbe2960) at codegen.cpp:4021
#35 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbdad50, i=1, stmt=@0x7fff5fbdad48, env=@0x7fff5fbdae38, ctx=0x7fff5fbe2960, terminated=@0x7fff5fbdad5f) at codegen.cpp:3521
#36 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbdae40, env=@0x7fff5fbdae38, ctx=0x7fff5fbe2960) at codegen.cpp:3597
#37 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbdc770, i=1, stmt=@0x7fff5fbdc768, env=@0x7fff5fbdc858, ctx=0x7fff5fbe2960, terminated=@0x7fff5fbdc77f) at codegen.cpp:3521
#38 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbdc860, env=@0x7fff5fbdc858, ctx=0x7fff5fbe2960) at codegen.cpp:3597
#39 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbde190, i=1, stmt=@0x7fff5fbde188, env=@0x7fff5fbdf030, ctx=0x7fff5fbe2960, terminated=@0x7fff5fbde19f) at codegen.cpp:3521
#40 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbdf038, env=@0x7fff5fbdf030, ctx=0x7fff5fbe2960) at codegen.cpp:3597
#41 0x000000010006eedc in clay::codegenStatement (stmt=@0x7fff5fbdfb20, env=@0x7fff5fbdfb18, ctx=0x7fff5fbe2960) at codegen.cpp:4000
#42 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbe1450, i=2, stmt=@0x7fff5fbe1448, env=@0x7fff5fbe1eb8, ctx=0x7fff5fbe2960, terminated=@0x7fff5fbe145f) at codegen.cpp:3521
#43 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbe1ec0, env=@0x7fff5fbe1eb8, ctx=0x7fff5fbe2960) at codegen.cpp:3597
#44 0x00000001000b189d in clay::codegenCodeBody (entry=0x1038e44b8) at codegen.cpp:3131
#45 0x00000001000a6e39 in clay::codegenCallCode (entry=0x1038e44b8, args=@0x7fff5fbe2f68, ctx=0x7fff5fbe8630, out=@0x7fff5fbe2f60) at codegen.cpp:2460
#46 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbe3980, args=@0x7fff5fbe3978, env=@0x7fff5fbe3970, ctx=0x7fff5fbe8630, out=@0x7fff5fbe3968) at codegen.cpp:2080
#47 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbe3d18, env=@0x7fff5fbe3d10, ctx=0x7fff5fbe8630, out=@0x7fff5fbe3d08) at codegen.cpp:1044
#48 0x0000000100074084 in codegenExprAsRef2 (expr=@0x7fff5fbe3e00, env=@0x7fff5fbe3df8, ctx=0x7fff5fbe8630) at codegen.cpp:683
#49 0x0000000100072236 in clay::codegenExprAsRef (expr=@0x7fff5fbe4f18, env=@0x7fff5fbe4f10, ctx=0x7fff5fbe8630) at codegen.cpp:753
#50 0x000000010006dcd4 in clay::codegenStatement (stmt=@0x7fff5fbe57f0, env=@0x7fff5fbe57e8, ctx=0x7fff5fbe8630) at codegen.cpp:3882
#51 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbe7120, i=0, stmt=@0x7fff5fbe7118, env=@0x7fff5fbe7b88, ctx=0x7fff5fbe8630, terminated=@0x7fff5fbe712f) at codegen.cpp:3521
#52 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbe7b90, env=@0x7fff5fbe7b88, ctx=0x7fff5fbe8630) at codegen.cpp:3597
#53 0x00000001000b189d in clay::codegenCodeBody (entry=0x1038e4350) at codegen.cpp:3131
#54 0x00000001000a6e39 in clay::codegenCallCode (entry=0x1038e4350, args=@0x7fff5fbe8c38, ctx=0x7fff5fbee300, out=@0x7fff5fbe8c30) at codegen.cpp:2460
#55 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbe9650, args=@0x7fff5fbe9648, env=@0x7fff5fbe9640, ctx=0x7fff5fbee300, out=@0x7fff5fbe9638) at codegen.cpp:2080
#56 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbe99e8, env=@0x7fff5fbe99e0, ctx=0x7fff5fbee300, out=@0x7fff5fbe99d8) at codegen.cpp:1044
#57 0x0000000100074084 in codegenExprAsRef2 (expr=@0x7fff5fbe9ad0, env=@0x7fff5fbe9ac8, ctx=0x7fff5fbee300) at codegen.cpp:683
#58 0x0000000100072236 in clay::codegenExprAsRef (expr=@0x7fff5fbeabe8, env=@0x7fff5fbeabe0, ctx=0x7fff5fbee300) at codegen.cpp:753
#59 0x000000010006dcd4 in clay::codegenStatement (stmt=@0x7fff5fbeb4c0, env=@0x7fff5fbeb4b8, ctx=0x7fff5fbee300) at codegen.cpp:3882
#60 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbecdf0, i=0, stmt=@0x7fff5fbecde8, env=@0x7fff5fbed858, ctx=0x7fff5fbee300, terminated=@0x7fff5fbecdff) at codegen.cpp:3521
#61 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbed860, env=@0x7fff5fbed858, ctx=0x7fff5fbee300) at codegen.cpp:3597
#62 0x00000001000b189d in clay::codegenCodeBody (entry=0x1038e1978) at codegen.cpp:3131
#63 0x00000001000a6e39 in clay::codegenCallCode (entry=0x1038e1978, args=@0x7fff5fbee908, ctx=0x7fff5fbfd450, out=@0x7fff5fbee900) at codegen.cpp:2460
#64 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbef320, args=@0x7fff5fbef318, env=@0x7fff5fbef310, ctx=0x7fff5fbfd450, out=@0x7fff5fbef308) at codegen.cpp:2080
#65 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbef6d8, env=@0x7fff5fbef6d0, ctx=0x7fff5fbfd450, out=@0x7fff5fbef6c8) at codegen.cpp:1044
#66 0x00000001000768c1 in clay::codegenExprInto (expr=@0x7fff5fbefaf8, env=@0x7fff5fbefaf0, ctx=0x7fff5fbfd450, out=@0x7fff5fbefae8) at codegen.cpp:856
#67 0x0000000100075189 in clay::codegenMultiInto (exprs=@0x7fff5fbf0c40, env=@0x7fff5fbf0c38, ctx=0x7fff5fbfd450, out=@0x7fff5fbf0c30, wantCount=1) at codegen.cpp:796
#68 0x00000001000b8c3d in clay::codegenBinding (x=@0x7fff5fbf0e30, env=@0x7fff5fbf0e28, ctx=0x7fff5fbfd450) at codegen.cpp:4145
#69 0x00000001000b58d8 in codegenBlockStatement (block=@0x7fff5fbf2700, i=0, stmt=@0x7fff5fbf26f8, env=@0x7fff5fbf2b28, ctx=0x7fff5fbfd450, terminated=@0x7fff5fbf270f) at codegen.cpp:3510
#70 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbf2b30, env=@0x7fff5fbf2b28, ctx=0x7fff5fbfd450) at codegen.cpp:3597
#71 0x00000001000ac6cc in clay::codegenCallInline (entry=0x1038e1810, args=@0x7fff5fbf2fc8, ctx=0x7fff5fbfd450, out=@0x7fff5fbf2fc0) at codegen.cpp:3347
#72 0x00000001000a6dc2 in clay::codegenCallCode (entry=0x1038e1810, args=@0x7fff5fbf3168, ctx=0x7fff5fbfd450, out=@0x7fff5fbf3160) at codegen.cpp:2456
#73 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbf3b80, args=@0x7fff5fbf3b78, env=@0x7fff5fbf3b70, ctx=0x7fff5fbfd450, out=@0x7fff5fbf3b68) at codegen.cpp:2080
#74 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbf3f18, env=@0x7fff5fbf3f10, ctx=0x7fff5fbfd450, out=@0x7fff5fbf3f08) at codegen.cpp:1044
#75 0x0000000100074084 in codegenExprAsRef2 (expr=@0x7fff5fbf4000, env=@0x7fff5fbf3ff8, ctx=0x7fff5fbfd450) at codegen.cpp:683
#76 0x0000000100072236 in clay::codegenExprAsRef (expr=@0x7fff5fbf5118, env=@0x7fff5fbf5110, ctx=0x7fff5fbfd450) at codegen.cpp:753
#77 0x000000010006dcd4 in clay::codegenStatement (stmt=@0x7fff5fbf59f0, env=@0x7fff5fbf59e8, ctx=0x7fff5fbfd450) at codegen.cpp:3882
#78 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbf7320, i=1, stmt=@0x7fff5fbf7318, env=@0x7fff5fbf7748, ctx=0x7fff5fbfd450, terminated=@0x7fff5fbf732f) at codegen.cpp:3521
#79 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbf7750, env=@0x7fff5fbf7748, ctx=0x7fff5fbfd450) at codegen.cpp:3597
#80 0x00000001000ac6cc in clay::codegenCallInline (entry=0x1038e8b78, args=@0x7fff5fbf7be8, ctx=0x7fff5fbfd450, out=@0x7fff5fbf7be0) at codegen.cpp:3347
#81 0x00000001000a6dc2 in clay::codegenCallCode (entry=0x1038e8b78, args=@0x7fff5fbf7d88, ctx=0x7fff5fbfd450, out=@0x7fff5fbf7d80) at codegen.cpp:2456
#82 0x0000000100080160 in clay::codegenCallExpr (callable=@0x7fff5fbf87a0, args=@0x7fff5fbf8798, env=@0x7fff5fbf8790, ctx=0x7fff5fbfd450, out=@0x7fff5fbf8788) at codegen.cpp:2080
#83 0x0000000100078231 in clay::codegenExpr (expr=@0x7fff5fbf8b38, env=@0x7fff5fbf8b30, ctx=0x7fff5fbfd450, out=@0x7fff5fbf8b28) at codegen.cpp:1044
#84 0x0000000100074084 in codegenExprAsRef2 (expr=@0x7fff5fbf8c20, env=@0x7fff5fbf8c18, ctx=0x7fff5fbfd450) at codegen.cpp:683
#85 0x0000000100072236 in clay::codegenExprAsRef (expr=@0x7fff5fbf9d38, env=@0x7fff5fbf9d30, ctx=0x7fff5fbfd450) at codegen.cpp:753
#86 0x000000010006dcd4 in clay::codegenStatement (stmt=@0x7fff5fbfa610, env=@0x7fff5fbfa608, ctx=0x7fff5fbfd450) at codegen.cpp:3882
#87 0x00000001000b5c2d in codegenBlockStatement (block=@0x7fff5fbfbf40, i=0, stmt=@0x7fff5fbfbf38, env=@0x7fff5fbfc9a8, ctx=0x7fff5fbfd450, terminated=@0x7fff5fbfbf4f) at codegen.cpp:3521
#88 0x0000000100067c38 in clay::codegenStatement (stmt=@0x7fff5fbfc9b0, env=@0x7fff5fbfc9a8, ctx=0x7fff5fbfd450) at codegen.cpp:3597
#89 0x00000001000b189d in clay::codegenCodeBody (entry=0x1038e8a10) at codegen.cpp:3131
#90 0x00000001000865d2 in clay::codegenCallable (x=@0x7fff5fbfd828, argsKey=@0x7fff5fbfd810, argsTempness=@0x7fff5fbfd7e0) at codegen.cpp:2534
#91 0x00000001000c4ac4 in initializeCtorsDtors () at codegen.cpp:6705
#92 0x00000001000c4615 in clay::codegenEntryPoints (module=@0x7fff5fbfe880, importedExternals=true) at codegen.cpp:6870
#93 0x0000000100214fac in clay::main2 (argc=7, argv=0x7fff5fbff4b0, envp=0x7fff5fbff4f0) at main.cpp:882
#94 0x0000000100229a61 in clay::parachute (mainfn=0x100210700 <clay::main2(int, char**, char const* const*)>, argc=7, argv=0x7fff5fbff4b0, envp=0x7fff5fbff4f0) at parachute.cpp:85
#95 0x0000000100218744 in main (argc=7, argv=0x7fff5fbff4b0, envp=0x7fff5fbff4f0) at main.cpp:987
Mac.
That assertion failure makes sense with the earlier crash; both are related to debugging information. My hunch is that the new binding code isn't generating debugger type info properly in some case.
You are correct, it's a 'ref' binding debug info error.
The error occurs while codegenning a ref to a variantRepr data field. The following line shows the type causing the problem:
llvmDIBuilder->createReferenceType( llvmTypeDebugInfo(Union[NoException, ValueMissing, Error, OSError]))
This reference type llvm assertion bug also occurs using the Clay v0.1 branch so I guess it has been around a while.
Same problem on Ubuntu 12.04 x86_64.
@stepancheg's original test case works for me after 7c28fad:
% cat simple.clay
main() { }
% ./build/compiler/clay -g simple.clay
% ./simple
However, the -g -e
combo still breaks, with a different assertion failure:
% ./build/compiler/clay -g -e ''
pseudo instructions should be removed before code emission
UNREACHABLE executed at /Users/joe/Documents/Code/others/llvm-3.1.src/lib/Target/X86/X86CodeEmitter.cpp:736!
Stack dump:
0. Running pass 'X86 Machine Code Emitter' on function '@"core.errors.backtrace.showBacktrace() clay"'
signal 4!
zsh: illegal hardware instruction ./build/compiler/clay -g -e ''
I think that's a different problem though. @stepancheg @agemogolk Can you verify that the original problem is fixed on your end?
I can confirm the simple.clay
test case works on Archlinux x86_64. The -g -e ''
case segfaults (llvm optimized build).
Thanks @agemogolk. I'll close this and open #404 for the problem with -g -e
.
Command line:
simple.clay:
Back trace:
Context:
Everything works fine without -g.
Mac, compiler from master.