<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LLVM modules are corrupted after a command line function call"
href="https://llvm.org/bugs/show_bug.cgi?id=27089">27089</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLVM modules are corrupted after a command line function call
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Support Libraries
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lore97drk@icloud.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>