You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A module with a top-level statement, imported as source, fails with "Global is referenced by parentless instruction" #447
A module that has a top-level statement fails to compile when another module imports it as source, i.e. without -shared. This happens under every memory model. The error is invalid LLVM IR:
test-runner -mm=gc import_tl.ts export_tl.ts
Global is referenced by parentless instruction!
ptr @puts
; ModuleID = 'LLVMDialectModule'
call addrspace(0) void @puts(ptr getelementptr inbounds nuw (i8, ptr @s_..., i64 8))
tslang: error: Failed to emit LLVM IR
The result is the same under -mm=rc, and with export const k = 5; in place of the function. Removing the top-level print makes it compile. The same pair with -shared also compiles and runs.
It looks as if the imported module's top-level code is generated with no enclosing function, or into one that is then dropped. The puts call is left with no parent.
Activity