[clang] [clang] Fix underlying type of EmbedExpr (PR #99050)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 16 07:45:16 PDT 2024


================
@@ -13,9 +13,9 @@ int ca[] = {
 };
 
 // CHECK: %arrayinit.element = getelementptr inbounds i32, ptr %notca, i64 1
-// CHECK: store i8 106, ptr %arrayinit.element, align 4
+// CHECK: store i32 106, ptr %arrayinit.element, align 4
----------------
Fznamznon wrote:

This is actually shows a bug in CodeGen for #embed, it should have always stored i32 because the target storage is i32. A cast emission is missing in CGExprAgg.cpp. Though I'm not sure it should be included into this PR.
Another problem is that I can't think of a good test case that shows that elements embedded in the initializer list are of int type and not of unsigned char type.

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


More information about the cfe-commits mailing list