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