[clang] [clang][bytecode] Guard strcmp against differing element types (PR #154777)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 24 21:34:34 PDT 2025
================
@@ -338,3 +338,12 @@ static void *FooTable[1] = {
}
};
+int strcmp(const char *, const char *); // all-note {{passing argument to parameter here}}
+#define S "\x01\x02\x03\x04\x05\x06\x07\x08"
+const char _str[] = {S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7]};
+const unsigned char _str2[] = {S[0], S[1], S[2], S[3], S[4], S[5], S[6], S[7]};
+const int compared = strcmp(_str, (const char *)_str2); // all-error {{initializer element is not a compile-time constant}}
----------------
shafik wrote:
Isn't this reject b/c of the reinterpret_cast? While the change is about the guard in `interp__builtin_strcmp`? Am I missing something?
https://github.com/llvm/llvm-project/pull/154777
More information about the cfe-commits
mailing list