2008-06-28 06:48:56 +08:00
|
|
|
// RUN: clang %s -emit-llvm -o -
|
2008-01-03 05:54:09 +08:00
|
|
|
|
|
|
|
// PR1895
|
|
|
|
// sizeof function
|
|
|
|
int zxcv(void);
|
|
|
|
int x=sizeof(zxcv);
|
|
|
|
int y=__alignof__(zxcv);
|
|
|
|
|
2008-01-03 14:36:51 +08:00
|
|
|
|
|
|
|
void *test(int *i) {
|
|
|
|
short a = 1;
|
|
|
|
i += a;
|
|
|
|
i + a;
|
|
|
|
a + i;
|
|
|
|
}
|
|
|
|
|
2008-01-30 15:01:17 +08:00
|
|
|
_Bool test2b;
|
|
|
|
int test2() {if (test2b);}
|
|
|
|
|
2008-01-31 12:12:50 +08:00
|
|
|
// PR1921
|
|
|
|
int test3() {
|
|
|
|
const unsigned char *bp;
|
|
|
|
bp -= (short)1;
|
|
|
|
}
|
|
|
|
|
2008-02-21 13:45:29 +08:00
|
|
|
// PR2080 - sizeof void
|
|
|
|
int t1 = sizeof(void);
|
|
|
|
int t2 = __alignof__(void);
|
|
|
|
void test4() {
|
|
|
|
t1 = sizeof(void);
|
|
|
|
t2 = __alignof__(void);
|
|
|
|
|
|
|
|
t1 = sizeof(test4());
|
|
|
|
t2 = __alignof__(test4());
|
|
|
|
}
|
|
|
|
|
2008-06-28 06:48:56 +08:00
|
|
|
// 'const float' promotes to double in varargs.
|
|
|
|
int test5(const float x, float float_number) {
|
|
|
|
return __builtin_isless(x, float_number);
|
|
|
|
}
|
|
|
|
|
2008-11-17 04:09:07 +08:00
|
|
|
// this one shouldn't fold
|
|
|
|
int ola() {
|
|
|
|
int a=2;
|
|
|
|
if ((0, (int)a) & 2) { return 1; }
|
|
|
|
return 2;
|
|
|
|
}
|
2008-11-20 01:44:31 +08:00
|
|
|
|
|
|
|
// this one shouldn't fold as well
|
|
|
|
void eMaisUma() {
|
|
|
|
double t[1];
|
|
|
|
if (*t)
|
|
|
|
return;
|
|
|
|
}
|
2009-02-11 15:21:43 +08:00
|
|
|
|
|
|
|
// rdar://6520707
|
|
|
|
void f0(void (*fp)(void), void (*fp2)(void)) {
|
|
|
|
int x = fp - fp2;
|
|
|
|
}
|
|
|
|
|
|
|
|
|