xref: /llvm-project/clang/test/CodeGen/2008-07-30-implicit-initialization.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -O2 -emit-llvm -o - %s | FileCheck %s
2 // CHECK-LABEL: define{{.*}} i32 @f0()
3 // CHECK:   ret i32 0
4 // CHECK-LABEL: define{{.*}} i32 @f1()
5 // CHECK:   ret i32 0
6 // CHECK-LABEL: define{{.*}} i32 @f2()
7 // CHECK:   ret i32 0
8 
9 struct s0 {
10   int x, y;
11 };
12 
f0(void)13 int f0(void) {
14   struct s0 x = {0};
15   return x.y;
16 }
17 
f1(void)18 int f1(void) {
19   struct s0 x[2] = { {0} };
20   return x[1].x;
21 }
22 
f2(void)23 int f2(void) {
24   int x[2] = { 0 };
25   return x[1];
26 }
27 
28