<html>
<head>
<base href="http://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 --- - llc -march=cpp doesn't work well with strings containing '\0'"
href="http://llvm.org/bugs/show_bug.cgi?id=20835">20835</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llc -march=cpp doesn't work well with strings containing '\0'
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</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>llc
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>virgile.bello@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Example:
static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
};
gets converted to:
Constant *const_array_80 = ConstantDataArray::getString(mod->getContext(),
"\x00\x00\xC0\xE0\xF0\xF8\xFC", false);
However, since StringRef will implicitely do a strlen, it will thinks it's a
zero sized string. As a result, it fails later because global and constant
types don't match.
Calling StringRef with explicit size should fix the issue:
Constant *const_array_80 = ConstantDataArray::getString(mod->getContext(),
StringRef("\x00\x00\xC0\xE0\xF0\xF8\xFC", 7), false);</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>