[LLVMdev] bug in the JIT global variable emitter

Nuno Lopes nunoplopes at sapo.pt
Mon Oct 13 14:42:21 PDT 2008


Hi,

Today I found a nice bug in the JIT global variable emitter.
The problem may lead to an assert() failure when doing the following:
1) compile some function
2) emit a global variable
3) compile another function. an assert() may trigger in the JIT memory 
manager

This happens because the JIT global variable emitter is using the 
MachineCodeEmitter::allocate() function, which uses memory allocated by the 
JIT memory manager (which should be used for functions only). The assert() 
is triggered because the global variable is dumped to the header of the free 
blocks list (provided that ThisAllocated becomes 1).

My proposed patch: 
http://web.ist.utl.pt/nuno.lopes/llvm_jit_global_emitter.txt (similar to 
what other JIT variable emitters do).

Please comment.

Thanks,
Nuno 




More information about the llvm-dev mailing list