blob: 81742673c2aafe26c9ea7ba1cf70a7af0c313f35 [file] [log] [blame]
Chris Lattner3cc5e5b2008-06-27 22:48:56 +00001// RUN: clang %s -emit-llvm -o -
Chris Lattnerefdd1572008-01-02 21:54:09 +00002
3// PR1895
4// sizeof function
5int zxcv(void);
6int x=sizeof(zxcv);
7int y=__alignof__(zxcv);
8
Chris Lattner8f925282008-01-03 06:36:51 +00009
10void *test(int *i) {
11 short a = 1;
12 i += a;
13 i + a;
14 a + i;
15}
16
Chris Lattner01e3c9e2008-01-30 07:01:17 +000017_Bool test2b;
18int test2() {if (test2b);}
19
Chris Lattner6860f3c2008-01-31 04:12:50 +000020// PR1921
21int test3() {
22 const unsigned char *bp;
23 bp -= (short)1;
24}
25
Chris Lattnera269ebf2008-02-21 05:45:29 +000026// PR2080 - sizeof void
27int t1 = sizeof(void);
28int t2 = __alignof__(void);
29void test4() {
30 t1 = sizeof(void);
31 t2 = __alignof__(void);
32
33 t1 = sizeof(test4());
34 t2 = __alignof__(test4());
35}
36
Chris Lattner3cc5e5b2008-06-27 22:48:56 +000037// 'const float' promotes to double in varargs.
38int test5(const float x, float float_number) {
39 return __builtin_isless(x, float_number);
40}
41
Nuno Lopesf9ef0c62008-11-16 20:09:07 +000042// this one shouldn't fold
43int ola() {
44 int a=2;
45 if ((0, (int)a) & 2) { return 1; }
46 return 2;
47}
Nuno Lopesa468d342008-11-19 17:44:31 +000048
49// this one shouldn't fold as well
50void eMaisUma() {
51 double t[1];
52 if (*t)
53 return;
54}
Chris Lattnere5ed1512009-02-11 07:21:43 +000055
56// rdar://6520707
57void f0(void (*fp)(void), void (*fp2)(void)) {
58 int x = fp - fp2;
59}
60
61