exprs.c revision c3953a61f7e2a9919ce18d418f8b26a8612e87f2
1// RUN: clang %s -emit-llvm -o - 2 3// PR1895 4// sizeof function 5int zxcv(void); 6int x=sizeof(zxcv); 7int y=__alignof__(zxcv); 8 9 10void *test(int *i) { 11 short a = 1; 12 i += a; 13 i + a; 14 a + i; 15} 16 17_Bool test2b; 18int test2() {if (test2b);} 19 20// PR1921 21int test3() { 22 const unsigned char *bp; 23 bp -= (short)1; 24} 25 26// 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 37// 'const float' promotes to double in varargs. 38int test5(const float x, float float_number) { 39 return __builtin_isless(x, float_number); 40} 41 42// this one shouldn't fold 43int ola() { 44 int a=2; 45 if ((0, (int)a) & 2) { return 1; } 46 return 2; 47} 48 49// this one shouldn't fold as well 50void eMaisUma() { 51 double t[1]; 52 if (*t) 53 return; 54} 55 56// rdar://6520707 57void f0(void (*fp)(void), void (*fp2)(void)) { 58 int x = fp - fp2; 59} 60 61// noop casts as lvalues. 62struct X { 63 int Y; 64}; 65struct X foo(); 66int bar() { 67 return ((struct X)foo()).Y + 1; 68} 69 70