forked from OSchip/llvm-project
Migrate most of the rest of test/FrontendC from llvm and migrate
most of them to FileCheck. llvm-svn: 136159
This commit is contained in:
parent
2dfed48cae
commit
85e5156598
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* Regression test. Just compile .c -> .ll to test */
|
||||
int foo(void) {
|
||||
unsigned char *pp;
|
||||
unsigned w_cnt;
|
||||
|
||||
w_cnt += *pp;
|
||||
|
||||
return w_cnt;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
// This caused generation of the following type name:
|
||||
// %Array = uninitialized global [10 x %complex int]
|
||||
//
|
||||
// which caused problems because of the space int the complex int type
|
||||
//
|
||||
|
||||
struct { int X, Y; } Array[10];
|
||||
|
||||
void foo() {}
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
void *dlclose(void*);
|
||||
|
||||
void ap_os_dso_unload(void *handle)
|
||||
{
|
||||
dlclose(handle);
|
||||
return; /* This return triggers the bug: Weird */
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* Test problem where bad code was generated with a ?: statement was
|
||||
in a function call argument */
|
||||
|
||||
void foo(int, double, float);
|
||||
|
||||
void bar(int x) {
|
||||
foo(x, x ? 1.0 : 12.5, 1.0f);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* This triggered a problem in reload, fixed by disabling most of the
|
||||
* steps of compilation in GCC. Before this change, the code went through
|
||||
* the entire backend of GCC, even though it was unnecessary for LLVM output
|
||||
* now it is skipped entirely, and since reload doesn't run, it can't cause
|
||||
* a problem.
|
||||
*/
|
||||
|
||||
extern int tolower(int);
|
||||
|
||||
const char *rangematch(const char *pattern, int test, int c) {
|
||||
|
||||
if ((c <= test) | (tolower(c) <= tolower((unsigned char)test)))
|
||||
return 0;
|
||||
|
||||
return pattern;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* This testcase causes a symbol table collision. Type names and variable
|
||||
* names should be in distinct namespaces
|
||||
*/
|
||||
|
||||
typedef struct foo {
|
||||
int X, Y;
|
||||
} FOO;
|
||||
|
||||
static FOO foo[100];
|
||||
|
||||
int test() {
|
||||
return foo[4].Y;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* Testcase for a problem where GCC allocated xqic to a register,
|
||||
* and did not have a VAR_DECL that explained the stack slot to LLVM.
|
||||
* Now the LLVM code synthesizes a stack slot if one is presented that
|
||||
* has not been previously recognized. This is where alloca's named
|
||||
* 'local' come from now.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
short x;
|
||||
} foostruct;
|
||||
|
||||
int foo(foostruct ic);
|
||||
|
||||
void test() {
|
||||
foostruct xqic;
|
||||
foo(xqic);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* GCC Used to generate code that contained a branch to the entry node of
|
||||
* the do_merge function. This is illegal LLVM code. To fix this, GCC now
|
||||
* inserts an entry node regardless of whether or not it has to insert allocas.
|
||||
*/
|
||||
|
||||
struct edge_rec
|
||||
{
|
||||
struct VERTEX *v;
|
||||
struct edge_rec *next;
|
||||
int wasseen;
|
||||
int more_data;
|
||||
};
|
||||
|
||||
typedef struct edge_rec *QUAD_EDGE;
|
||||
|
||||
typedef struct {
|
||||
QUAD_EDGE left, right;
|
||||
} EDGE_PAIR;
|
||||
|
||||
struct EDGE_STACK {
|
||||
int ptr;
|
||||
QUAD_EDGE *elts;
|
||||
int stack_size;
|
||||
};
|
||||
|
||||
int do_merge(QUAD_EDGE ldo, QUAD_EDGE rdo) {
|
||||
int lvalid;
|
||||
QUAD_EDGE basel,rcand;
|
||||
while (1) {
|
||||
if (!lvalid) {
|
||||
return (int)basel->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* test that locals are renamed with . notation */
|
||||
|
||||
void abc(void *);
|
||||
|
||||
void Test5(double X) {
|
||||
abc(&X);
|
||||
{
|
||||
int X;
|
||||
abc(&X);
|
||||
{
|
||||
float X;
|
||||
abc(&X);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
int test(int X) {
|
||||
return X;
|
||||
}
|
||||
|
||||
void abc(int *X);
|
||||
int def(int Y, int Z) {
|
||||
abc(&Z);
|
||||
return Y;
|
||||
}
|
||||
|
||||
struct Test { short X, x; int Y, Z; };
|
||||
|
||||
int Testing(struct Test *A) {
|
||||
return A->X+A->Y;
|
||||
}
|
||||
|
||||
int Test2(int X, struct Test A, int Y) {
|
||||
return X+Y+A.X+A.Y;
|
||||
}
|
||||
int Test3(struct Test A, struct Test B) {
|
||||
return A.X+A.Y+B.Y+B.Z;
|
||||
}
|
||||
|
||||
struct Test Test4(struct Test A) {
|
||||
return A;
|
||||
}
|
||||
|
||||
int Test6() {
|
||||
int B[200];
|
||||
return B[4];
|
||||
}
|
||||
|
||||
struct STest2 { int X; short Y[4]; double Z; };
|
||||
|
||||
struct STest2 Test7(struct STest2 X) {
|
||||
return X;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
double FOO = 17;
|
||||
double BAR = 12.0;
|
||||
float XX = 12.0f;
|
||||
|
||||
static char *procnames[] = {
|
||||
"EXIT"
|
||||
};
|
||||
|
||||
void *Data[] = { &FOO, &BAR, &XX };
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* GCC would generate bad code if not enough initializers are
|
||||
specified for an array.
|
||||
*/
|
||||
|
||||
int a[10] = { 0, 2};
|
||||
|
||||
char str[10] = "x";
|
||||
|
||||
void *Arr[5] = { 0, 0 };
|
||||
|
||||
float F[12] = { 1.23f, 34.7f };
|
||||
|
||||
struct Test { int X; double Y; };
|
||||
|
||||
struct Test Array[10] = { { 2, 12.0 }, { 3, 24.0 } };
|
||||
|
||||
int B[4][4] = { { 1, 2, 3, 4}, { 5, 6, 7 }, { 8, 9 } };
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
typedef struct Connection_Type {
|
||||
long to;
|
||||
char type[10];
|
||||
long length;
|
||||
} Connection;
|
||||
|
||||
Connection link[3]
|
||||
= { {1, "link1", 10},
|
||||
{2, "link2", 20},
|
||||
{3, "link3", 30} };
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* GCC was not emitting string constants of the correct length when
|
||||
* embedded into a structure field like this. It thought the strlength
|
||||
* was -1.
|
||||
*/
|
||||
|
||||
typedef struct Connection_Type {
|
||||
long to;
|
||||
char type[10];
|
||||
long length;
|
||||
} Connection;
|
||||
|
||||
Connection link[3]
|
||||
= { {1, "link1", 10},
|
||||
{2, "link2", 20},
|
||||
{3, "link3", 30} };
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* GCC was generating PHI nodes with an arity < #pred of the basic block the
|
||||
* PHI node lived in. This was breaking LLVM because the number of entries
|
||||
* in a PHI node must equal the number of predecessors for a basic block.
|
||||
*/
|
||||
|
||||
int trys(char *s, int x)
|
||||
{
|
||||
int asa;
|
||||
double Val;
|
||||
int LLS;
|
||||
if (x) {
|
||||
asa = LLS + asa;
|
||||
} else {
|
||||
}
|
||||
return asa+(int)Val;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* This code used to break GCC's SSA computation code. It would create
|
||||
uses of B & C that are not dominated by their definitions. See:
|
||||
http://gcc.gnu.org/ml/gcc/2002-03/msg00697.html
|
||||
*/
|
||||
int bar();
|
||||
int foo()
|
||||
{
|
||||
int a,b,c;
|
||||
|
||||
a = b + c;
|
||||
b = bar();
|
||||
c = bar();
|
||||
return a + b + c;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* GCC was not escaping quotes in string constants correctly, so this would
|
||||
* get emitted:
|
||||
* %.LC1 = internal global [32 x sbyte] c"*** Word "%s" on line %d is not\00"
|
||||
*/
|
||||
|
||||
const char *Foo() {
|
||||
return "*** Word \"%s\" on line %d is not";
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
int printf(const char *, ...);
|
||||
int foo();
|
||||
|
||||
int main() {
|
||||
while (foo()) {
|
||||
switch (foo()) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
printf("3");
|
||||
case 4: printf("4");
|
||||
case 5:
|
||||
case 6:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* GCC is not outputting the static array to the LLVM backend, so bad things
|
||||
* happen. Note that if this is defined static, everything seems fine.
|
||||
*/
|
||||
double test(unsigned X) {
|
||||
double student_t[30]={0.0 , 12.706 , 4.303 , 3.182 , 2.776 , 2.571 ,
|
||||
2.447 , 2.365 , 2.306 , 2.262 , 2.228 ,
|
||||
2.201 , 2.179 , 2.160 , 2.145 , 2.131 ,
|
||||
2.120 , 2.110 , 2.101 , 2.093 , 2.086 ,
|
||||
2.080 , 2.074 , 2.069 , 2.064 , 2.060 ,
|
||||
2.056 , 2.052 , 2.048 , 2.045 };
|
||||
return student_t[X];
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct S {
|
||||
int i;
|
||||
short s1, s2;
|
||||
};
|
||||
|
||||
struct S func_returning_struct(void);
|
||||
|
||||
void loop(void) {
|
||||
func_returning_struct();
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
typedef struct {
|
||||
char p;
|
||||
short q;
|
||||
char r;
|
||||
int X;
|
||||
short Y, Z;
|
||||
int Q;
|
||||
} foo;
|
||||
|
||||
int test(foo X, float);
|
||||
int testE(char,short,char,int,int,float);
|
||||
void test3(foo *X) {
|
||||
X->q = 1;
|
||||
}
|
||||
|
||||
void test2(foo Y) {
|
||||
testE(Y.p, Y.q, Y.r, Y.X, Y.Y, 0.1f);
|
||||
test(Y, 0.1f);
|
||||
test2(Y);
|
||||
test3(&Y);
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* Make sure the frontend is correctly marking static stuff as internal! */
|
||||
|
||||
int X;
|
||||
static int Y = 12;
|
||||
|
||||
static void foo(int Z) {
|
||||
Y = Z;
|
||||
}
|
||||
|
||||
void *test() {
|
||||
foo(12);
|
||||
return &Y;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* Testcase for when struct tag conflicts with typedef name... grr */
|
||||
|
||||
typedef struct foo {
|
||||
struct foo *X;
|
||||
int Y;
|
||||
} * foo;
|
||||
|
||||
foo F1;
|
||||
struct foo *F2;
|
||||
|
||||
enum bar { test1, test2 };
|
||||
|
||||
typedef float bar;
|
||||
|
||||
enum bar B1;
|
||||
bar B2;
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
// Test list stuff
|
||||
|
||||
void *malloc(unsigned);
|
||||
|
||||
// Test opaque structure support. the list type is defined later
|
||||
struct list;
|
||||
|
||||
struct list *PassThroughList(struct list *L) {
|
||||
return L;
|
||||
}
|
||||
|
||||
|
||||
// Recursive data structure tests...
|
||||
|
||||
typedef struct list {
|
||||
int Data;
|
||||
struct list *Next;
|
||||
} list;
|
||||
|
||||
list *Data;
|
||||
|
||||
void foo() {
|
||||
static int Foo = 0; // Test static local variable
|
||||
Foo += 1; // Increment static variable
|
||||
|
||||
Data = (list*)malloc(12); // This is not a proper list allocation
|
||||
}
|
||||
|
||||
extern list ListNode1;
|
||||
list ListNode3 = { 4, 0 };
|
||||
list ListNode2 = { 3, &ListNode3 };
|
||||
list ListNode0 = { 1, &ListNode1 };
|
||||
list ListNode1 = { 2, &ListNode2 };
|
||||
|
||||
|
||||
list ListArray[10];
|
||||
|
||||
// Iterative insert fn
|
||||
void InsertIntoListTail(list **L, int Data) {
|
||||
while (*L)
|
||||
L = &(*L)->Next;
|
||||
*L = (list*)malloc(sizeof(list));
|
||||
(*L)->Data = Data;
|
||||
(*L)->Next = 0;
|
||||
}
|
||||
|
||||
// Recursive list search fn
|
||||
list *FindData(list *L, int Data) {
|
||||
if (L == 0) return 0;
|
||||
if (L->Data == Data) return L;
|
||||
return FindData(L->Next, Data);
|
||||
}
|
||||
|
||||
void foundIt(void);
|
||||
|
||||
// Driver fn...
|
||||
void DoListStuff() {
|
||||
list *MyList = 0;
|
||||
InsertIntoListTail(&MyList, 100);
|
||||
InsertIntoListTail(&MyList, 12);
|
||||
InsertIntoListTail(&MyList, 42);
|
||||
InsertIntoListTail(&MyList, 1123);
|
||||
InsertIntoListTail(&MyList, 1213);
|
||||
|
||||
if (FindData(MyList, 75)) foundIt();
|
||||
if (FindData(MyList, 42)) foundIt();
|
||||
if (FindData(MyList, 700)) foundIt();
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null
|
||||
|
||||
/* These are random tests that I used when working on the GCC frontend
|
||||
originally. */
|
||||
|
||||
// test floating point comparison!
|
||||
int floatcomptest(double *X, double *Y, float *x, float *y) {
|
||||
return *X < *Y || *x < *y;
|
||||
}
|
||||
|
||||
extern void *malloc(unsigned);
|
||||
|
||||
// Exposed a bug
|
||||
void *memset_impl(void *dstpp, int c, unsigned len) {
|
||||
long long int dstp = (long long int) dstpp;
|
||||
|
||||
while (dstp % 4 != 0)
|
||||
{
|
||||
((unsigned char *) dstp)[0] = c;
|
||||
dstp += 1;
|
||||
len -= 1;
|
||||
}
|
||||
return dstpp;
|
||||
}
|
||||
|
||||
// TEST problem with signed/unsigned versions of the same constants being shared
|
||||
// incorrectly!
|
||||
//
|
||||
static char *temp;
|
||||
static int remaining;
|
||||
static char *localmalloc(int size) {
|
||||
char *blah;
|
||||
|
||||
if (size>remaining)
|
||||
{
|
||||
temp = (char *) malloc(32768);
|
||||
remaining = 32768;
|
||||
return temp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef struct { double X; double Y; int Z; } PBVTest;
|
||||
|
||||
PBVTest testRetStruct(float X, double Y, int Z) {
|
||||
PBVTest T = { X, Y, Z };
|
||||
return T;
|
||||
}
|
||||
PBVTest testRetStruct2(void); // external func no inlining
|
||||
|
||||
|
||||
double CallRetStruct(float X, double Y, int Z) {
|
||||
PBVTest T = testRetStruct2();
|
||||
return T.X+X+Y+Z;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
// Test ?: in function calls
|
||||
extern fp(int, char*);
|
||||
char *Ext;
|
||||
void
|
||||
__bb_exit_func (void)
|
||||
{
|
||||
fp (12, Ext ? Ext : "<none>");
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
char auto_kibitz_list[100][20] = {
|
||||
{"diepx"},
|
||||
{"ferret"},
|
||||
{"knightc"},
|
||||
{"knightcap"}};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
char * foo() { return "\\begin{"; }
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
union X {
|
||||
void *B;
|
||||
};
|
||||
|
||||
union X foo() {
|
||||
union X A;
|
||||
A.B = (void*)123;
|
||||
return A;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
union X;
|
||||
struct Empty {};
|
||||
union F {};
|
||||
union Q { union Q *X; };
|
||||
union X {
|
||||
char C;
|
||||
int A, Z;
|
||||
long long B;
|
||||
void *b1;
|
||||
struct { int A; long long Z; } Q;
|
||||
};
|
||||
|
||||
union X foo(union X A) {
|
||||
A.C = 123;
|
||||
A.A = 39249;
|
||||
//A.B = (void*)123040123321;
|
||||
A.B = 12301230123123LL;
|
||||
A.Z = 1;
|
||||
return A;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
int tcount;
|
||||
void test(char *, const char*, int);
|
||||
void foo() {
|
||||
char Buf[10];
|
||||
test(Buf, "n%%%d", tcount++);
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char type; /* Indicates, NORMAL, SUBNORMAL, etc. */
|
||||
} InternalFPF;
|
||||
|
||||
|
||||
static void SetInternalFPFZero(InternalFPF *dest) {
|
||||
dest->type=0;
|
||||
}
|
||||
|
||||
void denormalize(InternalFPF *ptr) {
|
||||
SetInternalFPFZero(ptr);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
typedef union {
|
||||
long (*ap)[4];
|
||||
} ptrs;
|
||||
|
||||
void DoAssignIteration() {
|
||||
ptrs abase;
|
||||
abase.ap+=27;
|
||||
Assignment(*abase.ap);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* This testcase doesn't actually test a bug, it's just the result of me
|
||||
* figuring out the syntax for forward declaring a static variable. */
|
||||
struct list {
|
||||
int x;
|
||||
struct list *Next;
|
||||
};
|
||||
|
||||
static struct list B; /* Forward declare static */
|
||||
static struct list A = { 7, &B };
|
||||
static struct list B = { 8, &A };
|
||||
|
||||
extern struct list D; /* forward declare normal var */
|
||||
|
||||
struct list C = { 7, &D };
|
||||
struct list D = { 8, &C };
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
int foo(int *A, unsigned X) {
|
||||
return A[X];
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
struct DWstruct {
|
||||
char high, low;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct DWstruct s;
|
||||
short ll;
|
||||
} DWunion;
|
||||
|
||||
short __udivmodhi4 (char n1, char bm) {
|
||||
DWunion rr;
|
||||
|
||||
if (bm == 0)
|
||||
{
|
||||
rr.s.high = n1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rr.s.high = bm;
|
||||
}
|
||||
|
||||
return rr.ll;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
void foo() {}
|
||||
|
||||
void bar() {
|
||||
foo(1, 2, 3); /* Too many arguments passed */
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
_Bool X = 0;
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
const char *W = "foo";
|
||||
const int X = 7;
|
||||
int Y = 8;
|
||||
const char * const Z = "bar";
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
extern char algbrfile[9];
|
||||
char algbrfile[9] = "abcdefgh";
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *stack;
|
||||
unsigned size;
|
||||
unsigned avail;
|
||||
} compile_stack_type;
|
||||
|
||||
void foo(void*);
|
||||
void bar(compile_stack_type T, unsigned);
|
||||
|
||||
void test() {
|
||||
compile_stack_type CST;
|
||||
foo(&CST);
|
||||
|
||||
bar(CST, 12);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
union foo {
|
||||
struct { char A, B; } X;
|
||||
int C;
|
||||
};
|
||||
|
||||
union foo V = { {1, 2} };
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
|
||||
|
||||
struct foo A;
|
||||
|
||||
struct foo {
|
||||
int x;
|
||||
double D;
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct Blend_Map_Entry {
|
||||
union {
|
||||
float Colour[5];
|
||||
double Point_Slope[2];
|
||||
} Vals;
|
||||
};
|
||||
|
||||
void test(struct Blend_Map_Entry* Foo)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
double Test(double A, double B, double C, double D) {
|
||||
return -(A-B) - (C-D);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct min_info {
|
||||
long offset;
|
||||
unsigned file_attr;
|
||||
} min_info;
|
||||
|
||||
typedef struct Globals {
|
||||
char answerbuf;
|
||||
min_info info[1];
|
||||
min_info *pInfo;
|
||||
} Uz_Globs;
|
||||
|
||||
extern Uz_Globs G;
|
||||
|
||||
int extract_or_test_files() {
|
||||
G.pInfo = G.info;
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -std=gnu89 -emit-llvm %s -o /dev/null
|
||||
|
||||
/* This is apparently legal C.
|
||||
*/
|
||||
extern __inline__ void test() { }
|
||||
|
||||
void test() {
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
/* RUN: %clang_cc1 %s -emit-llvm -o - | grep -v alloca | not grep bitcast
|
||||
*/
|
||||
|
||||
void test(int* array, long long N) {
|
||||
array[N] = N[array] = 33;
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/* RUN: %clang_cc1 %s -emit-llvm -o - | not grep __builtin_
|
||||
*
|
||||
* __builtin_longjmp/setjmp should get transformed into llvm.setjmp/longjmp
|
||||
* just like explicit setjmp/longjmp calls are.
|
||||
*/
|
||||
|
||||
void jumpaway(int *ptr) {
|
||||
__builtin_longjmp(ptr,1);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
__builtin_setjmp(0);
|
||||
jumpaway(0);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -x c %s -emit-llvm -o /dev/null
|
||||
|
||||
int test(_Bool pos, _Bool color) {
|
||||
return 0;
|
||||
return (pos && color);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
typedef struct {
|
||||
int op;
|
||||
} event_t;
|
||||
|
||||
event_t test(int X) {
|
||||
event_t foo = { 1 }, bar = { 2 };
|
||||
return X ? foo : bar;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
void foo()
|
||||
{
|
||||
char *ap;
|
||||
ap[1] == '-' && ap[2] == 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
|
||||
static int foo(int);
|
||||
|
||||
static int foo(C)
|
||||
char C;
|
||||
{
|
||||
return C;
|
||||
}
|
||||
|
||||
void test() {
|
||||
foo(7);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
extern int vfork(void);
|
||||
test() {
|
||||
vfork();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct bar;
|
||||
|
||||
void foo()
|
||||
{
|
||||
unsigned int frame, focus;
|
||||
(struct bar *) focus == (focus ? ((struct bar *) frame) : 0);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned long val;
|
||||
} structty;
|
||||
|
||||
void bar(structty new_mask);
|
||||
static void foo() {
|
||||
bar(({ structty mask; mask; }));
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
|
||||
union foo { int X; };
|
||||
|
||||
int test(union foo* F) {
|
||||
{
|
||||
union foo { float X; } A;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct Word {
|
||||
short bar;
|
||||
short baz;
|
||||
int final:1;
|
||||
short quux;
|
||||
} *word_limit;
|
||||
|
||||
void foo ()
|
||||
{
|
||||
word_limit->final = (word_limit->final && word_limit->final);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
void foo() {
|
||||
unsigned char int_latin1[] = "f\200\372b\200\343\200\340";
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct istruct {
|
||||
unsigned char C;
|
||||
};
|
||||
|
||||
struct foo {
|
||||
unsigned int I:1;
|
||||
struct istruct J;
|
||||
unsigned char L[1];
|
||||
unsigned int K:1;
|
||||
};
|
||||
|
||||
struct foo F = { 1, { 7 }, { 123 } , 1 };
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
enum En {
|
||||
ENUM_VAL
|
||||
};
|
||||
|
||||
struct St {
|
||||
unsigned char A;
|
||||
enum En B;
|
||||
unsigned char C;
|
||||
enum En D;
|
||||
float E;
|
||||
};
|
||||
|
||||
|
||||
void func(struct St* A) {
|
||||
A->D = ENUM_VAL;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct Foo {
|
||||
unsigned a;
|
||||
unsigned b;
|
||||
unsigned c;
|
||||
};
|
||||
|
||||
struct Bar {
|
||||
union {
|
||||
void **a;
|
||||
struct Foo b;
|
||||
}u;
|
||||
};
|
||||
|
||||
struct Bar test = {0};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
#ident "foo"
|
|
@ -0,0 +1,22 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
struct foo { int X; };
|
||||
struct bar { int Y; };
|
||||
|
||||
extern int Func(struct foo*) __asm__("Func64");
|
||||
extern int Func64(struct bar*);
|
||||
|
||||
int Func(struct foo *F) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Func64(struct bar* B) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int test() {
|
||||
Func(0); /* should be renamed to call Func64 */
|
||||
Func64(0);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct { int foo; } spinlock_t;
|
||||
typedef struct wait_queue_head_t { spinlock_t lock; } wait_queue_head_t;
|
||||
void call_usermodehelper(void) {
|
||||
struct wait_queue_head_t work = { lock: (spinlock_t) { 0 }, };
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct { } the_coolest_struct_in_the_world;
|
||||
extern the_coolest_struct_in_the_world xyzzy;
|
||||
void *foo() { return &xyzzy; }
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
union bdflush_param {
|
||||
struct { int x; } b_un;
|
||||
int y[1];
|
||||
} bdf_prm = {{30}};
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
// This should be turned into a tasty getelementptr instruction, not a nasty
|
||||
// series of casts and address arithmetic.
|
||||
|
||||
char Global[100];
|
||||
|
||||
char *test1(unsigned i) {
|
||||
// CHECK: getelementptr
|
||||
return &Global[i];
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct { } rwlock_t;
|
||||
struct fs_struct { rwlock_t lock; int umask; };
|
||||
void __copy_fs_struct(struct fs_struct *fs) { fs->lock = (rwlock_t) { }; }
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
void schedule_timeout(signed long timeout)
|
||||
{
|
||||
switch (timeout)
|
||||
{
|
||||
case ((long)(~0UL>>1)): break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
char *test(char* C) {
|
||||
// CHECK: getelementptr
|
||||
return C-1; // Should turn into a GEP
|
||||
}
|
||||
|
||||
int *test2(int* I) {
|
||||
return I-1;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
void query_newnamebuf(void) { ((void)"query_newnamebuf"); }
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
typedef struct { unsigned long pgprot; } pgprot_t;
|
||||
|
||||
void split_large_page(unsigned long addr, pgprot_t prot)
|
||||
{
|
||||
(addr ? prot : ((pgprot_t) { 0x001 } )).pgprot;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o /dev/null
|
||||
|
||||
struct item {
|
||||
short delta[4];
|
||||
};
|
||||
|
||||
int TEST(int nt) {
|
||||
register struct item *aa;
|
||||
aa[nt].delta;
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct _GIOChannel {
|
||||
int write_buf;
|
||||
char partial_write_buf[6];
|
||||
int d :1;
|
||||
};
|
||||
|
||||
void g_io_channel_init (struct _GIOChannel *channel) {
|
||||
channel->partial_write_buf[0];
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct face_cachel {
|
||||
unsigned int reverse :1;
|
||||
unsigned char font_specified[1];
|
||||
};
|
||||
|
||||
void
|
||||
ensure_face_cachel_contains_charset (struct face_cachel *cachel) {
|
||||
cachel->font_specified[0] = 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
int test() {
|
||||
__complex__ double C;
|
||||
double D;
|
||||
C / D;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct printf_spec {
|
||||
unsigned int minus_flag:1;
|
||||
char converter;
|
||||
};
|
||||
|
||||
void parse_doprnt_spec () {
|
||||
struct printf_spec spec;
|
||||
spec.minus_flag = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
unsigned long do_csum(const unsigned char *buff, int len, unsigned long result) {
|
||||
if (2 & (unsigned long) buff) result += 1;
|
||||
return result;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct i387_soft_struct {
|
||||
long cwd;
|
||||
};
|
||||
union i387_union {
|
||||
struct i387_soft_struct soft;
|
||||
};
|
||||
struct thread_struct {
|
||||
union i387_union i387;
|
||||
};
|
||||
void _init_task_union(void) {
|
||||
struct thread_struct thread = (struct thread_struct) { {{0}} };
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct i387_soft_struct {
|
||||
long cwd;
|
||||
long twd;
|
||||
long fip;
|
||||
};
|
||||
union i387_union {
|
||||
struct i387_soft_struct soft;
|
||||
};
|
||||
struct thread_struct {
|
||||
union i387_union i387;
|
||||
};
|
||||
void _init_task_union(void) {
|
||||
struct thread_struct thread = (struct thread_struct) { {{0}} };
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
// RUN: %clang_cc1 -std=gnu89 %s -emit-llvm -o - | not grep dead_function
|
||||
|
||||
extern __inline__ void dead_function() {}
|
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
/*
|
||||
* This regression test ensures that the C front end can compile initializers
|
||||
* even when it cannot determine the size (as below).
|
||||
*/
|
||||
struct one
|
||||
{
|
||||
int a;
|
||||
int values [];
|
||||
};
|
||||
|
||||
struct one hobbit = {5, {1, 2, 3}};
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
struct X { int V[10000]; };
|
||||
struct X Global1, Global2;
|
||||
void test() {
|
||||
// CHECK: llvm.memcpy
|
||||
Global2 = Global1;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
void *test1() {
|
||||
// CHECK: call i8* @llvm.returnaddress
|
||||
return __builtin_return_address(1);
|
||||
}
|
||||
void *test2() {
|
||||
// CHECK: call i8* @llvm.frameaddress
|
||||
return __builtin_frame_address(0);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | grep llvm.memset | count 3
|
||||
|
||||
void *memset(void*, int, unsigned long);
|
||||
void bzero(void*, unsigned long);
|
||||
|
||||
void test(int* X, char *Y) {
|
||||
// CHECK: call i8* llvm.memset
|
||||
memset(X, 4, 1000);
|
||||
// CHECK: call void bzero
|
||||
bzero(Y, 100);
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
// CHECK: zeroinitializer
|
||||
int X[1000];
|
|
@ -0,0 +1,6 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
void test(__complex__ double D, double X) {
|
||||
D /= X;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
||||
|
||||
// CHECK: @a = external constan
|
||||
extern const int a[]; // 'a' should be marked constant even though it's external!
|
||||
int foo () {
|
||||
return a[0];
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
// Test that these initializers are handled efficiently
|
||||
|
||||
int test(int x) {
|
||||
const int XX[1000] = { 0, 0 };
|
||||
const char S [1000] = "foo";
|
||||
|
||||
const int array[] = {
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
17, 23, 123, 123, 49, 17, 23, 123, 123, 49, 17, 23, 123, 123, 49,
|
||||
};
|
||||
return array[x];
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
int foo() {
|
||||
#ifdef __ppc__
|
||||
register int X __asm__("r1");
|
||||
#else
|
||||
register int X __asm__("ebx");
|
||||
#endif
|
||||
return X;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
int foo(int len, char arr[][len], int X) {
|
||||
return arr[X][0];
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %clang_cc1 -w -emit-llvm %s -o /dev/null
|
||||
|
||||
void test(enum foo *X) {
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
struct fu;
|
||||
void foo(struct fu);
|
||||
void bar() {
|
||||
foo;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
_Bool A, B, C, D, E, F, G, H;
|
||||
void TestF(float X, float Y) {
|
||||
A = __builtin_isgreater(X, Y);
|
||||
B = __builtin_isgreaterequal(X, Y);
|
||||
C = __builtin_isless(X, Y);
|
||||
D = __builtin_islessequal(X, Y);
|
||||
E = __builtin_islessgreater(X, Y);
|
||||
F = __builtin_isunordered(X, Y);
|
||||
//G = __builtin_isordered(X, Y); // Our current snapshot of GCC doesn't include this builtin
|
||||
H = __builtin_isunordered(X, Y);
|
||||
}
|
||||
void TestD(double X, double Y) {
|
||||
A = __builtin_isgreater(X, Y);
|
||||
B = __builtin_isgreaterequal(X, Y);
|
||||
C = __builtin_isless(X, Y);
|
||||
D = __builtin_islessequal(X, Y);
|
||||
E = __builtin_islessgreater(X, Y);
|
||||
F = __builtin_isunordered(X, Y);
|
||||
//G = __builtin_isordered(X, Y); // Our current snapshot doesn't include this builtin. FIXME
|
||||
H = __builtin_isunordered(X, Y);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
struct S { };
|
||||
|
||||
int xxxx(int a) {
|
||||
struct S comps[a];
|
||||
comps[0];
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
static int unused_func(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int foo(void) {
|
||||
(void)unused_func; /* avoid compiler warning */
|
||||
return 2;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
|
||||
|
||||
#define A(X) int X;
|
||||
#define B(X) A(X##0) A(X##1) A(X##2) A(X##3) A(X##4) A(X##5) A(X##6) A(X##7) \
|
||||
A(X##8) A(X##9) A(X##A) A(X##B) A(X##C) A(X##D) A(X##E) A(X##F)
|
||||
#define C(X) B(X##0) B(X##1) B(X##2) B(X##3) B(X##4) B(X##5) B(X##6) B(X##7) \
|
||||
B(X##8) B(X##9) B(X##A) B(X##B) B(X##C) B(X##D) B(X##E) B(X##F)
|
||||
|
||||
struct foo {
|
||||
C(x); // 256
|
||||
C(y); // 256
|
||||
C(z);
|
||||
};
|
||||
|
||||
|
||||
int test(struct foo *F) {
|
||||
return F->xA1 + F->yFF + F->zC4;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
|
||||
// This is a testcase for PR461
|
||||
typedef struct {
|
||||
unsigned min_align: 1;
|
||||
unsigned : 1;
|
||||
} addr_diff_vec_flags;
|
||||
|
||||
addr_diff_vec_flags X;
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o - | \
|
||||
// RUN: opt -std-compile-opts -emit-llvm | not grep {declare i32.*func}
|
||||
|
||||
// There should not be an unresolved reference to func here. Believe it or not,
|
||||
// the "expected result" is a function named 'func' which is internal and
|
||||
// referenced by bar().
|
||||
|
||||
// This is PR244
|
||||
|
||||
static int func();
|
||||
void bar() {
|
||||
int func();
|
||||
foo(func);
|
||||
}
|
||||
static int func(char** A, char ** B) {}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue