[clang] fix(clang): Fix miscompile for string literals. (PR #202837)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 09:36:03 PDT 2026


https://github.com/erichkeane commented:

I'm tempted by this fix based on how simplistic it is, but it definitely is going to cause a large amount of memory to be used, which is unfortunate.  

I believe we are completely tolerant of initializing with an insufficiently sized string literal: Rather than creating a string literal, we should probably just not be modifying the string literal so that these sizes don't affect each-other.  That is, when we do the `char rest[100] = "shorter string"`, we shouldn't be modifying the string literal, so sharing them should be completely acceptable.

https://github.com/llvm/llvm-project/pull/202837


More information about the cfe-commits mailing list