LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 20851 - MCJIT is failing when used with more that one module
Summary: MCJIT is failing when used with more that one module
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: MCJIT (show other bugs)
Version: trunk
Hardware: PC All
: P normal
Assignee: Lang Hames
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-04 20:07 PDT by deadalnix
Modified: 2014-09-05 18:46 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description deadalnix 2014-09-04 20:07:44 PDT
Sample code: http://pastebin.com/fL1yTVCk

Compilation: gcc fail.c -m64 `/Users/amaury/d/llvm/build/Debug+Asserts/bin/llvm-config --cflags` `/Users/amaury/d/llvm/build/Debug+Asserts/bin/llvm-config --ldflags` `/Users/amaury/d/llvm/build/Debug+Asserts/bin/llvm-config --libs` -lc++ -lncurses -lz

$ ./a.out
; ModuleID = 'm1'
; ModuleID = 'm2'

define i32 @foo() {
  ret i32 42
}
Bus error: 10

Further exploration showed me that the failure happen when calling the Jitted function. It look like the generated code is invalid.
Comment 1 Lang Hames 2014-09-05 15:19:30 PDT
Reproduced locally. I'll investigate shortly.
Comment 2 Lang Hames 2014-09-05 18:39:17 PDT
Hi deadalnix,

As discussed on IRC, I think this was due to an iterator invalidation bug in MCJIT. I've fixed that issue in r217291.

Could you check that out and see if it fixes your issue?

Cheers,
Lang.
Comment 3 deadalnix 2014-09-05 18:46:13 PDT
It looks good, closing, and thank you !