[PATCH] Make sure BitcodeWriter works with Unicode characters

Keno Fischer kfischer at college.harvard.edu
Sun Nov 9 13:17:07 PST 2014


Previously when a metadata string contained unicode characters,
it would be incorrectly placed in the Record array because chars
are signed by default and hence characters with the high bit set
would get sign extended, but the bitcode writer was attempting
to write the lowest 8 bit of the now sign-extended value. This
caused an assertion failure later on. The fix is just to cast
the pointer to uint8_t* first to prevent sign extension.
This came up in the context for metadata strings, but I did a
quick pass and changed the other instances of this pattern in
the file as well.

http://reviews.llvm.org/D6184

Files:
  lib/Bitcode/Writer/BitcodeWriter.cpp
  test/Bitcode/unicode.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6184.15959.patch
Type: text/x-patch
Size: 2049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141109/a3806ad5/attachment.bin>


More information about the llvm-commits mailing list