[LLVMbugs] [Bug 20835] New: llc -march=cpp doesn't work well with strings containing '\0'
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Sep 2 08:54:44 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20835
Bug ID: 20835
Summary: llc -march=cpp doesn't work well with strings
containing '\0'
Product: tools
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: llc
Assignee: unassignedbugs at nondot.org
Reporter: virgile.bello at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
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);
--
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/20140902/717dcd0e/attachment.html>
More information about the llvm-bugs
mailing list