[clang] fix(clang): Fix miscompile for string literals. (PR #202837)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 22 13:54:11 PDT 2026
https://github.com/mizvekov commented:
> 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.
This.
Even if somehow using the shorter string literal isn't a simple change, the change here is too broad as it applies to all string literals appearing in dependent contexts, when we only need this when the string literal is used as the initializer of a char array.
https://github.com/llvm/llvm-project/pull/202837
More information about the cfe-commits
mailing list