[clang] [clang] Fix crash when #embed used in a compound literal (PR #102304)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 05:48:47 PDT 2024


================
@@ -1,9 +1,15 @@
 // RUN: %clang_cc1 %s -triple x86_64 --embed-dir=%S/Inputs -emit-llvm -o - | FileCheck %s
 
+// CHECK: @.compoundliteral = internal global [2 x i8] c"jk"
 // CHECK: @__const._Z3fooi.ca = private unnamed_addr constant [3 x i32] [i32 0, i32 106, i32 107], align 4
 // CHECK: @__const._Z3fooi.sc = private unnamed_addr constant %struct.S1 { i32 106, i32 107, i32 0 }, align 4
 // CHECK: @__const._Z3fooi.t = private unnamed_addr constant [3 x %struct.T] [%struct.T { [2 x i32] [i32 48, i32 49], %struct.S1 { i32 50, i32 51, i32 52 } }, %struct.T { [2 x i32] [i32 53, i32 54], %struct.S1 { i32 55, i32 56, i32 57 } }, %struct.T { [2 x i32] [i32 10, i32 0], %struct.S1 zeroinitializer }], align 16
 // CHECK: @__const._Z3fooi.W = private unnamed_addr constant %struct.Wrapper { i32 48, %struct.HasCharArray { [10 x i8] c"123456789\0A" } }, align 4
+
+char *p = (char[]){
+#embed "jk.txt"
+};
+
----------------
Fznamznon wrote:

No problem. Is it ok now?

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


More information about the cfe-commits mailing list