1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -Wno-strict-prototypes -emit-llvm -o - | FileCheck %s
7 int y
=__alignof__(zxcv
);
18 int test2(void) { if (test2b
); return 0; }
22 const unsigned char *bp
;
26 // PR2080 - sizeof void
27 int t1
= sizeof(void);
28 int t2
= __alignof__(void);
31 t2
= __alignof__(void);
34 t2
= __alignof__(test4());
37 // 'const float' promotes to double in varargs.
38 int test5(const float x
, float float_number
) {
39 return __builtin_isless(x
, float_number
);
42 // this one shouldn't fold
45 if ((0, (int)a
) & 2) { return 1; }
49 // this one shouldn't fold as well
56 void f0(void (*fp
)(void), void (*fp2
)(void)) {
60 // noop casts as lvalues.
66 return ((struct X
)foo()).Y
+ 1;
69 // PR3809: INC/DEC of function pointers.
72 void (*fp
)(void) = f2
;
81 union f3_x
{int x
; float y
;};
82 int f3(void) {return ((union f3_x
)2).x
;}
84 union f4_y
{int x
; _Complex
float y
;};
85 _Complex
float f4(void) {return ((union f4_y
)(_Complex
float)2.0).y
;}
87 struct f5_a
{ int a
; } f5_a
;
88 union f5_z
{int x
; struct f5_a y
;};
89 struct f5_a
f5(void) {return ((union f5_z
)f5_a
).y
;}
92 struct s6
{ int f0
; };
93 int f6(int a0
, struct s6 a1
, struct s6 a2
) {
94 return (a0
? a1
: a2
).f0
;
104 return ({ foo(); }).Y
;
112 struct S
{ struct C c
; };
113 void f9(struct S
*x
) {
114 foo(((void)1, x
->c
).tab
[0]);
121 // CHECK-LABEL: define{{.*}} i32 @f11
126 // CHECK: [[Xaddr:%[^ ]+]] = alloca i64, align 8
127 // CHECK: [[A:%.*]] = alloca [100 x i32], align
128 // CHECK: [[X:%.*]] = load {{.*}}, ptr [[Xaddr]]
129 // CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [100 x i32], ptr [[A]], i64 0, i64 [[X]]
130 // CHECK-NEXT: load i32, ptr [[T0]], align 4
135 // CHECK-LABEL: define{{.*}} i32 @f12
140 // Make sure negate of fp uses -0.0 for proper -0 handling.
141 double f13(double X
) {
142 // CHECK-LABEL: define{{.*}} double @f13
143 // CHECK: fneg double
147 // Check operations on incomplete types.
148 void f14(struct s14
*a
) {
152 // CHECK-LABEL: define{{.*}} void @f15
154 extern void f15_start(void);
156 // CHECK: call void @f15_start()
158 extern void *f15_v(void);
159 extern const void *f15_cv(void);
160 extern volatile void *f15_vv(void);
161 *f15_v(); *f15_v(), *f15_v(); f15_v() ? *f15_v() : *f15_v();
162 *f15_cv(); *f15_cv(), *f15_cv(); f15_cv() ? *f15_cv() : *f15_cv();
163 *f15_vv(); *f15_vv(), *f15_vv(); f15_vv() ? *f15_vv() : *f15_vv();
168 // PR8967: this was crashing
169 // CHECK-LABEL: define{{.*}} void @f16()
171 __extension__({ goto lbl
; });
176 // PR13704: negative increment in i128 is not preserved.
177 // CHECK-LABEL: define{{.*}} void @f17()
179 extern void extfunc(__int128
);
183 // CHECK: add nsw i128 %{{.}}, -1
186 // PR23597: We should evaluate union cast operands even if the cast is unused.
190 int returns_int(void);
192 (strct
)returns_int();
194 // CHECK-LABEL: define{{.*}} void @f18()
195 // CHECK: call i32 @returns_int()
197 // Ensure the right stmt is returned
201 // CHECK-LABEL: define{{.*}} i32 @f19()
202 // CHECK: [[T:%.*]] = alloca i32
203 // CHECK: store i32 4, ptr [[T]]
204 // CHECK: [[L:%.*]] = load i32, ptr [[T]]
205 // CHECK: ret i32 [[L]]