[llvm-dev] LLJIT global constants string becomes invalid in generated code

Haoran Xu via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 4 20:57:31 PST 2020


Hi,

Recently I hit an issue that LLJIT crashes when CodeGenOpt::Less or higher
is given.
After investigation, it turned out that the issue is some global constant
string in the IR, like

> @.str.117 = private unnamed_addr constant [9 x i8] c"lineitem\00", align 1
>
becomes an invalid pointer in the generated code.

> $1 = 0xf7fab054 <error: Cannot access memory at address 0xf7fab054>
>

The issue doesn't show up when CodeGenOpt::None is given. It also doesn't
show up when the host program (which uses the LLVM library) is compiled
with "-O0". So it looks like some kind of use-after-free issue.

Does any one have seen similar issues before, or have some idea on how to
fix this?
Thanks!

Best,
Haoran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201104/72679260/attachment.html>


More information about the llvm-dev mailing list