[PATCH] D48928: [ms] Fix mangling of string literals used to initialize arrays larger or smaller than the literal

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 4 03:24:14 PDT 2018

hans created this revision.
hans added reviewers: thakis, majnemer.

A Chromium developer reported a bug which turned out to be a mangling collision between these two literals:

  char s[] = "foo";
  char t[32] = "foo";

They may look the same, but for the initialization of t we will (under some circumstances) use a literal that's extended with zeros, and both the length and those zeros should be accounted for by the mangling.

This actually makes the mangling code simpler: where it previously had special logic for null terminators, which are not part of the StringLiteral, that is now covered by the general algorithm.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48928.154082.patch
Type: text/x-patch
Size: 5045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180704/b24d50a5/attachment.bin>

More information about the cfe-commits mailing list