1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -o - | FileCheck %s
7 int y=__alignof__(zxcv);
18 int test2() { 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
57 void f0(void (*fp)(void), void (*fp2)(void)) {
61 // noop casts as lvalues.
67 return ((struct X)foo()).Y + 1;
70 // PR3809: INC/DEC of function pointers.
73 void (*fp)(void) = f2;
82 union f3_x {int x; float y;};
83 int f3() {return ((union f3_x)2).x;}
85 union f4_y {int x; _Complex float y;};
86 _Complex float f4() {return ((union f4_y)(_Complex float)2.0).y;}
88 struct f5_a { int a; } f5_a;
89 union f5_z {int x; struct f5_a y;};
90 struct f5_a f5() {return ((union f5_z)f5_a).y;}
93 struct s6 { int f0; };
94 int f6(int a0, struct s6 a1, struct s6 a2) {
95 return (a0 ? a1 : a2).f0;
105 return ({ foo(); }).Y;
114 struct S { struct C c; };
115 void f9(struct S *x) {
116 foo(((void)1, x->c).tab[0]);
124 // CHECK-LABEL: define i32 @f11
129 // CHECK: [[Xaddr:%[^ ]+]] = alloca i64, align 8
130 // CHECK: load {{.*}}, {{.*}}* [[Xaddr]]
131 // CHECK-NEXT: getelementptr inbounds [100 x i32], [100 x i32]* %A, i32 0,
132 // CHECK-NEXT: load i32, i32*
137 // CHECK-LABEL: define i32 @f12
142 // Make sure negate of fp uses -0.0 for proper -0 handling.
143 double f13(double X) {
144 // CHECK-LABEL: define double @f13
145 // CHECK: fsub double -0.0
149 // Check operations on incomplete types.
150 void f14(struct s14 *a) {
154 // CHECK-LABEL: define void @f15
156 extern void f15_start(void);
158 // CHECK: call void @f15_start()
160 extern void *f15_v(void);
161 extern const void *f15_cv(void);
162 extern volatile void *f15_vv(void);
163 *f15_v(); *f15_v(), *f15_v(); f15_v() ? *f15_v() : *f15_v();
164 *f15_cv(); *f15_cv(), *f15_cv(); f15_cv() ? *f15_cv() : *f15_cv();
165 *f15_vv(); *f15_vv(), *f15_vv(); f15_vv() ? *f15_vv() : *f15_vv();
170 // PR8967: this was crashing
171 // CHECK-LABEL: define void @f16()
173 __extension__({ goto lbl; });
178 // PR13704: negative increment in i128 is not preserved.
179 // CHECK-LABEL: define void @f17()
181 extern void extfunc(__int128);
185 // CHECK: add nsw i128 %{{.}}, -1
188 // PR23597: We should evaluate union cast operands even if the cast is unused.
192 int returns_int(void);
194 (strct)returns_int();
196 // CHECK-LABEL: define void @f18()
197 // CHECK: call i32 @returns_int()