If a piece of terra code requires a shared library that hasn't been loaded using terralib.linklibrary, and the method :disas() is called on the function, calling a terra function afterwards will segfault even though it doesn't use any missing functions. The other terra function can still be compiled, disassembled, saved to files, etc.
Minimal reproducer:
local terra foo(a: int) return a + 2 end
terralib.saveobj("libfoo.so", {foo = foo})
foo = terralib.externfunction("foo", int -> int)
local terra bar() return foo(5) end
terralib.linklibrary("./libfoo.so") -- line A
bar:disas() -- line B
print()
local terra baz() return 5 end
print("should print 5:", baz()) -- line C
If line A is commented and lines B and C are uncommented, this code segfaults. In all other combinations, it runs as expected with no error messages, diagnostics, or warnings.
If a piece of terra code requires a shared library that hasn't been loaded using
terralib.linklibrary
, and the method:disas()
is called on the function, calling a terra function afterwards will segfault even though it doesn't use any missing functions. The other terra function can still be compiled, disassembled, saved to files, etc.Minimal reproducer:
If line A is commented and lines B and C are uncommented, this code segfaults. In all other combinations, it runs as expected with no error messages, diagnostics, or warnings.