[llvm-bugs] [Bug 27089] New: LLVM modules are corrupted after a command line function call

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 27 11:05:29 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27089

            Bug ID: 27089
           Summary: LLVM modules are corrupted after a command line
                    function call
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: lore97drk at icloud.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

In these days I’ve integrated llc code into my compiler.

I had an undefined behaviour because when
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion) is
called, the modules I give to the code in input to compile got somehow
“corrupted" by this function.
It is definitely an undefined behaviour because every debug I do, modules gets
different changes, producing different assertions every run:

- Target triple string gets changes with null characters
(“\0\0\0\0\0\0\0\0\0\0\0”), or other values that have nothing to do with an
llvm triple
- Head of the function list contained in the module becomes NULL (I said
functions but maybe other components may be nullified as well)

I tried to see where the modules change, and I figured out that 6/10 times the
target triple is ok before that instruction, then it takes weird changes after
it.
The problem is that function because when I removed it, everything worked fine.


To reproduce this effect, just try to compile a module given by a Module object
created before the call of
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion)
(Function called in the llc source code at the initialization) and then use llc
compileModule() function, changing it a little to make it compile a module
object and not a module parsed in a file.
It will assert in different parts of the code each run because every run
modules get different changes.

(I used Xcode debugger to see what happened to the modules)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160327/9590d295/attachment.html>


More information about the llvm-bugs mailing list