Finally discovered that corrupt memory was being written to generated code due to a redundant malloc call. This caused uninitialized data to be written to output code. I think it's fixed now.