diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-17 07:59:14 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-17 07:59:14 +0000 |
| commit | 83b3d8267225d585678d5d3af9bba5735f4b415d (patch) | |
| tree | 9d6c2ad7bfd568186e83a39e6f03e1c0bf415715 /llvm/test/CFrontend | |
| parent | 100602d7561ca5e245db6194bddae86357d203d4 (diff) | |
| download | bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.tar.gz bcm5719-llvm-83b3d8267225d585678d5d3af9bba5735f4b415d.zip | |
Regression is gone, don't try to find it on clean target.
llvm-svn: 33296
Diffstat (limited to 'llvm/test/CFrontend')
174 files changed, 2488 insertions, 0 deletions
diff --git a/llvm/test/CFrontend/.cvsignore b/llvm/test/CFrontend/.cvsignore new file mode 100644 index 00000000000..7f2443f2f31 --- /dev/null +++ b/llvm/test/CFrontend/.cvsignore @@ -0,0 +1,3 @@ +Output +*.log +*.sum diff --git a/llvm/test/CFrontend/2002-01-23-LoadQISIReloadFailure.c b/llvm/test/CFrontend/2002-01-23-LoadQISIReloadFailure.c new file mode 100644 index 00000000000..258d3cc0e3d --- /dev/null +++ b/llvm/test/CFrontend/2002-01-23-LoadQISIReloadFailure.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-01-24-ComplexSpaceInType.c b/llvm/test/CFrontend/2002-01-24-ComplexSpaceInType.c new file mode 100644 index 00000000000..9559d5b37b7 --- /dev/null +++ b/llvm/test/CFrontend/2002-01-24-ComplexSpaceInType.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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() {} diff --git a/llvm/test/CFrontend/2002-01-24-HandleCallInsnSEGV.c b/llvm/test/CFrontend/2002-01-24-HandleCallInsnSEGV.c new file mode 100644 index 00000000000..09029fb945e --- /dev/null +++ b/llvm/test/CFrontend/2002-01-24-HandleCallInsnSEGV.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void *dlclose(void*); + +void ap_os_dso_unload(void *handle) +{ + dlclose(handle); + return; /* This return triggers the bug: Weird */ +} diff --git a/llvm/test/CFrontend/2002-02-13-ConditionalInCall.c b/llvm/test/CFrontend/2002-02-13-ConditionalInCall.c new file mode 100644 index 00000000000..0dad6ff5c2f --- /dev/null +++ b/llvm/test/CFrontend/2002-02-13-ConditionalInCall.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} + diff --git a/llvm/test/CFrontend/2002-02-13-ReloadProblem.c b/llvm/test/CFrontend/2002-02-13-ReloadProblem.c new file mode 100644 index 00000000000..ab9b56da3e3 --- /dev/null +++ b/llvm/test/CFrontend/2002-02-13-ReloadProblem.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-02-13-TypeVarNameCollision.c b/llvm/test/CFrontend/2002-02-13-TypeVarNameCollision.c new file mode 100644 index 00000000000..ec334013ae0 --- /dev/null +++ b/llvm/test/CFrontend/2002-02-13-TypeVarNameCollision.c @@ -0,0 +1,16 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2002-02-13-UnnamedLocal.c b/llvm/test/CFrontend/2002-02-13-UnnamedLocal.c new file mode 100644 index 00000000000..6fdc7efdd3a --- /dev/null +++ b/llvm/test/CFrontend/2002-02-13-UnnamedLocal.c @@ -0,0 +1,21 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} + + diff --git a/llvm/test/CFrontend/2002-02-14-EntryNodePreds.c b/llvm/test/CFrontend/2002-02-14-EntryNodePreds.c new file mode 100644 index 00000000000..f1e01515fd7 --- /dev/null +++ b/llvm/test/CFrontend/2002-02-14-EntryNodePreds.c @@ -0,0 +1,37 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; + } + } +} + diff --git a/llvm/test/CFrontend/2002-02-16-RenamingTest.c b/llvm/test/CFrontend/2002-02-16-RenamingTest.c new file mode 100644 index 00000000000..952af90c87e --- /dev/null +++ b/llvm/test/CFrontend/2002-02-16-RenamingTest.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); + } + } +} + diff --git a/llvm/test/CFrontend/2002-02-17-ArgumentAddress.c b/llvm/test/CFrontend/2002-02-17-ArgumentAddress.c new file mode 100644 index 00000000000..937929559fe --- /dev/null +++ b/llvm/test/CFrontend/2002-02-17-ArgumentAddress.c @@ -0,0 +1,39 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-02-18-64bitConstant.c b/llvm/test/CFrontend/2002-02-18-64bitConstant.c new file mode 100644 index 00000000000..6fd3e29d242 --- /dev/null +++ b/llvm/test/CFrontend/2002-02-18-64bitConstant.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +/* GCC wasn't handling 64 bit constants right fixed */ + +void main() { + long long Var = 123455678902ll; + printf("%lld\n", Var); +} diff --git a/llvm/test/CFrontend/2002-02-18-StaticData.c b/llvm/test/CFrontend/2002-02-18-StaticData.c new file mode 100644 index 00000000000..10439c37309 --- /dev/null +++ b/llvm/test/CFrontend/2002-02-18-StaticData.c @@ -0,0 +1,13 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +double FOO = 17; +double BAR = 12.0; +float XX = 12.0f; + +static char *procnames[] = { + "EXIT" +}; + +void *Data[] = { &FOO, &BAR, &XX }; + diff --git a/llvm/test/CFrontend/2002-03-11-LargeCharInString.c b/llvm/test/CFrontend/2002-03-11-LargeCharInString.c new file mode 100644 index 00000000000..d8a1671fc77 --- /dev/null +++ b/llvm/test/CFrontend/2002-03-11-LargeCharInString.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +#include <string.h> + +int test(char *X) { + /* LLVM-GCC used to emit: + %.LC0 = internal global [3 x sbyte] c"\1F\FFFFFF8B\00" + */ + return strcmp(X, "\037\213"); +} diff --git a/llvm/test/CFrontend/2002-03-12-ArrayInitialization.c b/llvm/test/CFrontend/2002-03-12-ArrayInitialization.c new file mode 100644 index 00000000000..d6cf44625bd --- /dev/null +++ b/llvm/test/CFrontend/2002-03-12-ArrayInitialization.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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 } }; diff --git a/llvm/test/CFrontend/2002-03-12-StructInitialize.c b/llvm/test/CFrontend/2002-03-12-StructInitialize.c new file mode 100644 index 00000000000..5174ad4906d --- /dev/null +++ b/llvm/test/CFrontend/2002-03-12-StructInitialize.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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} }; + diff --git a/llvm/test/CFrontend/2002-03-12-StructInitializer.c b/llvm/test/CFrontend/2002-03-12-StructInitializer.c new file mode 100644 index 00000000000..cf2ba4e8cf8 --- /dev/null +++ b/llvm/test/CFrontend/2002-03-12-StructInitializer.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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} }; + diff --git a/llvm/test/CFrontend/2002-03-14-BrokenPHINode.c b/llvm/test/CFrontend/2002-03-14-BrokenPHINode.c new file mode 100644 index 00000000000..16d9bc7814f --- /dev/null +++ b/llvm/test/CFrontend/2002-03-14-BrokenPHINode.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2002-03-14-BrokenSSA.c b/llvm/test/CFrontend/2002-03-14-BrokenSSA.c new file mode 100644 index 00000000000..01f259738e3 --- /dev/null +++ b/llvm/test/CFrontend/2002-03-14-BrokenSSA.c @@ -0,0 +1,17 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2002-03-14-QuotesInStrConst.c b/llvm/test/CFrontend/2002-03-14-QuotesInStrConst.c new file mode 100644 index 00000000000..42f82bfa895 --- /dev/null +++ b/llvm/test/CFrontend/2002-03-14-QuotesInStrConst.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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"; +} diff --git a/llvm/test/CFrontend/2002-04-07-SwitchStmt.c b/llvm/test/CFrontend/2002-04-07-SwitchStmt.c new file mode 100644 index 00000000000..79632c9eb8a --- /dev/null +++ b/llvm/test/CFrontend/2002-04-07-SwitchStmt.c @@ -0,0 +1,22 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-04-08-LocalArray.c b/llvm/test/CFrontend/2002-04-08-LocalArray.c new file mode 100644 index 00000000000..af6ebd6bdf9 --- /dev/null +++ b/llvm/test/CFrontend/2002-04-08-LocalArray.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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. + */ +void 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]; +} diff --git a/llvm/test/CFrontend/2002-04-09-StructRetVal.c b/llvm/test/CFrontend/2002-04-09-StructRetVal.c new file mode 100644 index 00000000000..c655e4a4d05 --- /dev/null +++ b/llvm/test/CFrontend/2002-04-09-StructRetVal.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct S { + int i; + short s1, s2; +}; + +struct S func_returning_struct(void); + +void loop(void) { + func_returning_struct(); +} diff --git a/llvm/test/CFrontend/2002-04-10-StructParameters.c b/llvm/test/CFrontend/2002-04-10-StructParameters.c new file mode 100644 index 00000000000..9db6a132bc1 --- /dev/null +++ b/llvm/test/CFrontend/2002-04-10-StructParameters.c @@ -0,0 +1,25 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} + diff --git a/llvm/test/CFrontend/2002-05-23-StaticValues.c b/llvm/test/CFrontend/2002-05-23-StaticValues.c new file mode 100644 index 00000000000..bf583e203d3 --- /dev/null +++ b/llvm/test/CFrontend/2002-05-23-StaticValues.c @@ -0,0 +1,15 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-05-23-TypeNameCollision.c b/llvm/test/CFrontend/2002-05-23-TypeNameCollision.c new file mode 100644 index 00000000000..43faf97b1e6 --- /dev/null +++ b/llvm/test/CFrontend/2002-05-23-TypeNameCollision.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; + diff --git a/llvm/test/CFrontend/2002-05-24-Alloca.c b/llvm/test/CFrontend/2002-05-24-Alloca.c new file mode 100644 index 00000000000..ac5b78d0c99 --- /dev/null +++ b/llvm/test/CFrontend/2002-05-24-Alloca.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char **argv) { + char *C = (char*)alloca(argc); + strcpy(C, argv[0]); + puts(C); +} diff --git a/llvm/test/CFrontend/2002-06-25-FWriteInterfaceFailure.c b/llvm/test/CFrontend/2002-06-25-FWriteInterfaceFailure.c new file mode 100644 index 00000000000..fb1b54bf72e --- /dev/null +++ b/llvm/test/CFrontend/2002-06-25-FWriteInterfaceFailure.c @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +#include <stdio.h> + +void test() { + fprintf(stderr, "testing\n"); +} diff --git a/llvm/test/CFrontend/2002-07-14-MiscListTests.c b/llvm/test/CFrontend/2002-07-14-MiscListTests.c new file mode 100644 index 00000000000..baae585f6c3 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-14-MiscListTests.c @@ -0,0 +1,71 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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(); +} + diff --git a/llvm/test/CFrontend/2002-07-14-MiscTests.c b/llvm/test/CFrontend/2002-07-14-MiscTests.c new file mode 100644 index 00000000000..e78dbd72eb9 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-14-MiscTests.c @@ -0,0 +1,57 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + + diff --git a/llvm/test/CFrontend/2002-07-14-MiscTests2.c b/llvm/test/CFrontend/2002-07-14-MiscTests2.c new file mode 100644 index 00000000000..ac58926abf2 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-14-MiscTests2.c @@ -0,0 +1,13 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +// Test ?: in function calls +extern fp(int, char*); +char *Ext; +void +__bb_exit_func (void) +{ + fp (12, Ext ? Ext : "<none>"); +} + + diff --git a/llvm/test/CFrontend/2002-07-14-MiscTests3.c b/llvm/test/CFrontend/2002-07-14-MiscTests3.c new file mode 100644 index 00000000000..9a262d5fcef --- /dev/null +++ b/llvm/test/CFrontend/2002-07-14-MiscTests3.c @@ -0,0 +1,187 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + + +void *malloc(unsigned); + +//#include <stdio.h> +int puts(const char *s); + +struct FunStructTest { + int Test1; + char *Pointer; + int Array[12]; +}; + +struct SubStruct { + short X, Y; +}; + +struct Quad { + int w; + struct SubStruct SS; + struct SubStruct *SSP; + char c; + int y; +}; + +struct Quad GlobalQuad = { 4, {1, 2}, 0, 3, 156 }; + +typedef int (*FuncPtr)(int); + +unsigned PtrFunc(int (*Func)(int), int X) { + return Func(X); +} + +char PtrFunc2(FuncPtr FuncTab[30], int Num) { + return FuncTab[Num]('b'); +} + +extern char SmallArgs2(char w, char x, long long Zrrk, char y, char z); +extern int SomeFunc(void); +char SmallArgs(char w, char x, char y, char z) { + SomeFunc(); + return SmallArgs2(w-1, x+1, y, z, w); +} + +static int F0(struct Quad Q, int i) { /* Pass Q by value */ + struct Quad R; + if (i) R.SS = Q.SS; + Q.SSP = &R.SS; + Q.w = Q.y = Q.c = 1; + return Q.SS.Y + i + R.y - Q.c; +} + +int F1(struct Quad *Q, int i) { /* Pass Q by address */ + struct Quad R; +#if 0 + if (i) R.SS = Q->SS; +#else + if (i) R = *Q; +#endif + Q->w = Q->y = Q->c = 1; + return Q->SS.Y+i+R.y-Q->c; +} + + +int BadFunc(float Val) { + int Result; + if (Val > 12.345) Result = 4; + return Result; /* Test use of undefined value */ +} + +int RealFunc(void) { + return SomeUndefinedFunction(1, 4, 5); +} + +extern int EF1(int *, char *, int *); + +int Func(int Param, long long Param2) { + int Result = Param; + + {{{{ + char c; int X; + EF1(&Result, &c, &X); + }}} + + { // c & X are duplicate names! + char c; int X; + EF1(&Result, &c, &X); + } + + } + return Result; +} + + +short FunFunc(long long x, char z) { + return x+z; +} + +unsigned castTest(int X) { return X; } + +double TestAdd(double X, float Y) { + return X+Y+.5; +} + +int func(int i, int j) { + while (i != 20) + i += 2; + + j += func(2, i); + return (i * 3 + j*2)*j; +} + +int SumArray(int Array[], int Num) { + int i, Result = 0; + for (i = 0; i < Num; ++i) + Result += Array[i]; + + return Result; +} + +int ArrayParam(int Values[100]) { + return EF1((int*)Values[50], (char*)1, &Values[50]); +} + +int ArrayToSum(void) { + int A[100], i; + for (i = 0; i < 100; ++i) + A[i] = i*4; + + return A[A[0]]; //SumArray(A, 100); +} + + +int ExternFunc(long long, unsigned*, short, unsigned char); + +int main(int argc, char *argv[]) { + unsigned i; + puts("Hello world!\n"); + + ExternFunc(-1, 0, (short)argc, 2); + //func(argc, argc); + + for (i = 0; i < 10; i++) + puts(argv[3]); + return 0; +} + +double MathFunc(double X, double Y, double Z, + double AA, double BB, double CC, double DD, + double EE, double FF, double GG, double HH, + double aAA, double aBB, double aCC, double aDD, + double aEE, double aFF) { + return X + Y + Z + AA + BB + CC + DD + EE + FF + GG + HH + + aAA + aBB + aCC + aDD + aEE + aFF; +} + + + +void strcpy(char *s1, char *s2) { + while (*s1++ = *s2++); +} + +void strcat(char *s1, char *s2) { + while (*s1++); + s1--; + while (*s1++ = *s2++); +} + +int strcmp(char *s1, char *s2) { + while (*s1++ == *s2++); + if (*s1 == 0) { + if (*s2 == 0) { + return 0; + } else { + return -1; + } + } else { + if (*s2 == 0) { + return 1; + } else { + return (*(--s1) - *(--s2)); + } + } +} + diff --git a/llvm/test/CFrontend/2002-07-16-HardStringInit.c b/llvm/test/CFrontend/2002-07-16-HardStringInit.c new file mode 100644 index 00000000000..d1d03216ce1 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-16-HardStringInit.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + char auto_kibitz_list[100][20] = { + {"diepx"}, + {"ferret"}, + {"knightc"}, + {"knightcap"}}; + diff --git a/llvm/test/CFrontend/2002-07-17-StringConstant.c b/llvm/test/CFrontend/2002-07-17-StringConstant.c new file mode 100644 index 00000000000..8a392033f39 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-17-StringConstant.c @@ -0,0 +1,4 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +char * foo() { return "\\begin{"; } diff --git a/llvm/test/CFrontend/2002-07-29-Casts.c b/llvm/test/CFrontend/2002-07-29-Casts.c new file mode 100644 index 00000000000..6794e80b5e3 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-29-Casts.c @@ -0,0 +1,86 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> + +int +main(int argc, char** argv) +{ + char c1; + short s1, ssf1, ssd1; + unsigned char ubs0; + signed char bs0; + unsigned char ubc0, uc2; + unsigned short us2, usf1, usd1; + int ic3, is3, sif1, sid1; + unsigned int uic4, uis4, uif1, uid1; + long slf1, sld1; + unsigned long ulf1, uld1; + float f1; + double d1; + + /* Test integer to integer conversions */ + + c1 = (char) (argc >= 2)? atoi(argv[1]) : 0xff64; /* 100 = 'd' */ + s1 = (short) (argc >= 3)? atoi(argv[2]) : -769; /* 0xf7ff = -769 */ + + ubc0 = (unsigned char) c1; /* 100 = 'd' */ + ubs0 = (unsigned char) s1; /* 0xff = 255 */ + bs0 = (signed char) s1; /* 0xff = -1 */ + + uc2 = (unsigned char) c1; /* 100 = 'd' */ + us2 = (unsigned short) s1; /* 0xf7ff = 64767 */ + + ic3 = (int) c1; /* 100 = 'd' */ + is3 = (int) s1; /* 0xfffff7ff = -769 */ + + uic4 = (unsigned int) c1; /* 100 = 'd' */ + uis4 = (unsigned int) s1; /* 0xfffff7ff = 4294966527 */ + + printf("ubc0 = '%c'\n", ubc0); + printf("ubs0 = %u\n", ubs0); + printf("bs0 = %d\n", bs0); + printf("c1 = '%c'\n", c1); + printf("s1 = %d\n", s1); + printf("uc2 = '%c'\n", uc2); + printf("us2 = %u\n", us2); + printf("ic3 = '%c'\n", ic3); + printf("is3 = %d\n", is3); + printf("uic4 = '%c'\n", uic4); + printf("uis4 = %u\n", uis4); + + /* Test floating-point to integer conversions */ + f1 = (float) (argc >= 4)? atof(argv[3]) : 1.0; + d1 = (argc >= 5)? atof(argv[4]) : 2.0; + + usf1 = (unsigned short) f1; + usd1 = (unsigned short) d1; + uif1 = (unsigned int) f1; + uid1 = (unsigned int) d1; + ulf1 = (unsigned long) f1; + uld1 = (unsigned long) d1; + + ssf1 = (short) f1; + ssd1 = (short) d1; + sif1 = (int) f1; + sid1 = (int) d1; + slf1 = (long) f1; + sld1 = (long) d1; + + printf("usf1 = %u\n", usf1); + printf("usd1 = %u\n", usd1); + printf("uif1 = %u\n", uif1); + printf("uid1 = %u\n", uid1); + printf("ulf1 = %u\n", ulf1); + printf("uld1 = %u\n", uld1); + + printf("ssf1 = %d\n", ssf1); + printf("ssd1 = %d\n", ssd1); + printf("sif1 = %d\n", sif1); + printf("sid1 = %d\n", sid1); + printf("slf1 = %d\n", slf1); + printf("sld1 = %d\n", sld1); + + return 0; +} diff --git a/llvm/test/CFrontend/2002-07-30-SubregSetAssertion.c b/llvm/test/CFrontend/2002-07-30-SubregSetAssertion.c new file mode 100644 index 00000000000..6d4f9f62058 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-30-SubregSetAssertion.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +union X { + void *B; +}; + +union X foo() { + union X A; + A.B = (void*)123; + return A; +} diff --git a/llvm/test/CFrontend/2002-07-30-UnionTest.c b/llvm/test/CFrontend/2002-07-30-UnionTest.c new file mode 100644 index 00000000000..b2c481e4079 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-30-UnionTest.c @@ -0,0 +1,22 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-07-30-VarArgsCallFailure.c b/llvm/test/CFrontend/2002-07-30-VarArgsCallFailure.c new file mode 100644 index 00000000000..b37a462220b --- /dev/null +++ b/llvm/test/CFrontend/2002-07-30-VarArgsCallFailure.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +int tcount; +void test(char *, const char*, int); +void foo() { + char Buf[10]; + test(Buf, "n%%%d", tcount++); +} diff --git a/llvm/test/CFrontend/2002-07-31-BadAssert.c b/llvm/test/CFrontend/2002-07-31-BadAssert.c new file mode 100644 index 00000000000..5801d03a099 --- /dev/null +++ b/llvm/test/CFrontend/2002-07-31-BadAssert.c @@ -0,0 +1,16 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} + diff --git a/llvm/test/CFrontend/2002-07-31-SubregFailure.c b/llvm/test/CFrontend/2002-07-31-SubregFailure.c new file mode 100644 index 00000000000..15573f9128a --- /dev/null +++ b/llvm/test/CFrontend/2002-07-31-SubregFailure.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +typedef union { + long (*ap)[4]; +} ptrs; + +void DoAssignIteration() { + ptrs abase; + abase.ap+=27; + Assignment(*abase.ap); +} + + diff --git a/llvm/test/CFrontend/2002-08-02-UnionTest.c b/llvm/test/CFrontend/2002-08-02-UnionTest.c new file mode 100644 index 00000000000..bc44e461dec --- /dev/null +++ b/llvm/test/CFrontend/2002-08-02-UnionTest.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +/* In this testcase, the return value of foo() is being promotedto a register + * which breaks stuff + */ +#include <stdio.h> + +union X { char X; void *B; int a, b, c, d;}; + +union X foo() { + union X Global; + Global.B = (void*)123; /* Interesting part */ + return Global; +} + +void main() { + union X test = foo(); + printf("0x%p", test.B); +} diff --git a/llvm/test/CFrontend/2002-08-19-RecursiveLocals.c b/llvm/test/CFrontend/2002-08-19-RecursiveLocals.c new file mode 100644 index 00000000000..e5007af7254 --- /dev/null +++ b/llvm/test/CFrontend/2002-08-19-RecursiveLocals.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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 }; + diff --git a/llvm/test/CFrontend/2002-09-08-PointerShifts.c b/llvm/test/CFrontend/2002-09-08-PointerShifts.c new file mode 100644 index 00000000000..cc7e91a7f9a --- /dev/null +++ b/llvm/test/CFrontend/2002-09-08-PointerShifts.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +int foo(int *A, unsigned X) { + return A[X]; +} diff --git a/llvm/test/CFrontend/2002-09-18-UnionProblem.c b/llvm/test/CFrontend/2002-09-18-UnionProblem.c new file mode 100644 index 00000000000..56ec6cec8ed --- /dev/null +++ b/llvm/test/CFrontend/2002-09-18-UnionProblem.c @@ -0,0 +1,26 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2002-09-19-StarInLabel.c b/llvm/test/CFrontend/2002-09-19-StarInLabel.c new file mode 100644 index 00000000000..86a2571d57b --- /dev/null +++ b/llvm/test/CFrontend/2002-09-19-StarInLabel.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +extern void start() __asm__("start"); +extern void _start() __asm__("_start"); +extern void __start() __asm__("__start"); +void start() {} +void _start() {} +void __start() {} + diff --git a/llvm/test/CFrontend/2002-10-12-TooManyArguments.c b/llvm/test/CFrontend/2002-10-12-TooManyArguments.c new file mode 100644 index 00000000000..206cdd98da0 --- /dev/null +++ b/llvm/test/CFrontend/2002-10-12-TooManyArguments.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +void foo() {} + +void bar() { + foo(1, 2, 3); /* Too many arguments passed */ +} diff --git a/llvm/test/CFrontend/2002-11-07-Redefinition.c b/llvm/test/CFrontend/2002-11-07-Redefinition.c new file mode 100644 index 00000000000..2be3c8ff1d9 --- /dev/null +++ b/llvm/test/CFrontend/2002-11-07-Redefinition.c @@ -0,0 +1,60 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +/* Provide Declarations */ + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef __cplusplus +typedef unsigned char bool; +#endif + + +/* Support for floating point constants */ +typedef unsigned long long ConstantDoubleTy; +typedef unsigned int ConstantFloatTy; + + +/* Global Declarations */ + +/* External Global Variable Declarations */ + +/* Function Declarations */ +void __main(); +int printf(signed char *, ...); +void testfunc(short l5_s, float l11_X, signed char l3_C, signed long long l9_LL, int l7_I, double l12_D); +void main(); + +/* Malloc to make sun happy */ +extern void * malloc(size_t); + + + +/* Global Variable Declerations */ +extern signed char l27_d_LC0[26]; + + +/* Global Variable Definitions and Initialization */ +static signed char l27_d_LC0[26] = "%d, %f, %d, %lld, %d, %f\n"; + + +/* Function Bodies */ +void testfunc(short l5_s, float l11_X, signed char l3_C, signed long long l9_LL, int l7_I, double l12_D) { + int l7_reg226; + + + l7_reg226 = printf((&(l27_d_LC0[0ll])), ((unsigned )l5_s), ((double )l11_X), ((unsigned )l3_C), l9_LL, l7_I, l12_D); + return; +} + +void main() { + + const ConstantFloatTy FloatConstant0 = 0x3f9f5c29; /* 1.245 */ + const ConstantDoubleTy FloatConstant1 = 0x432ff973cafa8000; /* 4.5e+15 */ + + __main(); + testfunc(12, (*(float*)&FloatConstant0), 120, 123456677890ll, -10, (*(double*)&FloatConstant1)); + return; +} + diff --git a/llvm/test/CFrontend/2002-12-15-GlobalBoolTest.c b/llvm/test/CFrontend/2002-12-15-GlobalBoolTest.c new file mode 100644 index 00000000000..6b27391d9b5 --- /dev/null +++ b/llvm/test/CFrontend/2002-12-15-GlobalBoolTest.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +_Bool X = 0; + diff --git a/llvm/test/CFrontend/2002-12-15-GlobalConstantTest.c b/llvm/test/CFrontend/2002-12-15-GlobalConstantTest.c new file mode 100644 index 00000000000..a5a679db675 --- /dev/null +++ b/llvm/test/CFrontend/2002-12-15-GlobalConstantTest.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +const char *W = "foo"; +const int X = 7; +int Y = 8; +const char * const Z = "bar"; + diff --git a/llvm/test/CFrontend/2002-12-15-GlobalRedefinition.c b/llvm/test/CFrontend/2002-12-15-GlobalRedefinition.c new file mode 100644 index 00000000000..39632a15066 --- /dev/null +++ b/llvm/test/CFrontend/2002-12-15-GlobalRedefinition.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +extern char algbrfile[9]; +char algbrfile[9] = "abcdefgh"; + diff --git a/llvm/test/CFrontend/2002-12-15-StructParameters.c b/llvm/test/CFrontend/2002-12-15-StructParameters.c new file mode 100644 index 00000000000..c85dab1cd1e --- /dev/null +++ b/llvm/test/CFrontend/2002-12-15-StructParameters.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} diff --git a/llvm/test/CFrontend/2003-01-30-UnionInit.c b/llvm/test/CFrontend/2003-01-30-UnionInit.c new file mode 100644 index 00000000000..b33ae0214a6 --- /dev/null +++ b/llvm/test/CFrontend/2003-01-30-UnionInit.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o /dev/null +// XFAIL: llvmgcc3 + +union foo { + struct { char A, B; } X; + int C; +}; + +union foo V = { {1, 2} }; diff --git a/llvm/test/CFrontend/2003-02-12-NonlocalGoto.c b/llvm/test/CFrontend/2003-02-12-NonlocalGoto.c new file mode 100644 index 00000000000..81d97e06b5f --- /dev/null +++ b/llvm/test/CFrontend/2003-02-12-NonlocalGoto.c @@ -0,0 +1,26 @@ +// RUN: %llvmgcc -S %s -o /dev/null + +// XFAIL: * +/* It is unlikely that LLVM will ever support nested functions, but if it does, + here is a testcase. */ + +main() +{ + __label__ l; + + void*x() + { + goto l; + } + + x(); + abort(); + return; +l: + exit(0); +} + + + + + diff --git a/llvm/test/CFrontend/2003-03-03-DeferredType.c b/llvm/test/CFrontend/2003-03-03-DeferredType.c new file mode 100644 index 00000000000..fa51991b305 --- /dev/null +++ b/llvm/test/CFrontend/2003-03-03-DeferredType.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + + + +struct foo A; + +struct foo { + int x; +double D; +}; + diff --git a/llvm/test/CFrontend/2003-06-22-UnionCrash.c b/llvm/test/CFrontend/2003-06-22-UnionCrash.c new file mode 100644 index 00000000000..dab0716ae63 --- /dev/null +++ b/llvm/test/CFrontend/2003-06-22-UnionCrash.c @@ -0,0 +1,13 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct Blend_Map_Entry { + union { + float Colour[5]; + double Point_Slope[2]; + } Vals; +}; + +void test(struct Blend_Map_Entry* Foo) +{ +} + diff --git a/llvm/test/CFrontend/2003-06-23-GCC-fold-infinite-recursion.c b/llvm/test/CFrontend/2003-06-23-GCC-fold-infinite-recursion.c new file mode 100644 index 00000000000..ba66276683b --- /dev/null +++ b/llvm/test/CFrontend/2003-06-23-GCC-fold-infinite-recursion.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +double Test(double A, double B, double C, double D) { + return -(A-B) - (C-D); +} + diff --git a/llvm/test/CFrontend/2003-06-26-CFECrash.c b/llvm/test/CFrontend/2003-06-26-CFECrash.c new file mode 100644 index 00000000000..bb6977f4838 --- /dev/null +++ b/llvm/test/CFrontend/2003-06-26-CFECrash.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2003-06-29-MultipleFunctionDefinition.c b/llvm/test/CFrontend/2003-06-29-MultipleFunctionDefinition.c new file mode 100644 index 00000000000..b7bc8033067 --- /dev/null +++ b/llvm/test/CFrontend/2003-06-29-MultipleFunctionDefinition.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +/* This is apparently legal C. + */ +extern __inline__ void test() { } + +void test() { +} diff --git a/llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr b/llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr new file mode 100644 index 00000000000..705b2590a6b --- /dev/null +++ b/llvm/test/CFrontend/2003-07-22-ArrayAccessTypeSafety.c.tr @@ -0,0 +1,7 @@ +/* RUN: %llvmgcc -xc %s -c -o - | dis | not grep cast + */ + +void test(int* array, long long N) { + array[N] = N[array] = 33; +} + diff --git a/llvm/test/CFrontend/2003-08-06-BuiltinSetjmpLongjmp.c.tr b/llvm/test/CFrontend/2003-08-06-BuiltinSetjmpLongjmp.c.tr new file mode 100644 index 00000000000..4bdbf988bdc --- /dev/null +++ b/llvm/test/CFrontend/2003-08-06-BuiltinSetjmpLongjmp.c.tr @@ -0,0 +1,14 @@ +/* RUN: %llvmgcc -xc %s -c -o - | dis | 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); +} diff --git a/llvm/test/CFrontend/2003-08-17-DeadCodeShortCircuit.c.tr b/llvm/test/CFrontend/2003-08-17-DeadCodeShortCircuit.c.tr new file mode 100644 index 00000000000..0027da6c488 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-17-DeadCodeShortCircuit.c.tr @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -xc %s -c + +int test(_Bool pos, _Bool color) { + return 0; + return (pos && color); +} + diff --git a/llvm/test/CFrontend/2003-08-18-SigSetJmp.c b/llvm/test/CFrontend/2003-08-18-SigSetJmp.c new file mode 100644 index 00000000000..b7f4553f41d --- /dev/null +++ b/llvm/test/CFrontend/2003-08-18-SigSetJmp.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +#include <setjmp.h> + +sigjmp_buf B; +int foo() { + sigsetjmp(B, 1); + bar(); +} diff --git a/llvm/test/CFrontend/2003-08-18-StructAsValue.c b/llvm/test/CFrontend/2003-08-18-StructAsValue.c new file mode 100644 index 00000000000..649eadc4e45 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-18-StructAsValue.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +typedef struct { + int op; +} event_t; + +event_t test(int X) { + event_t foo = { 1 }, bar = { 2 }; + return X ? foo : bar; +} diff --git a/llvm/test/CFrontend/2003-08-20-BadBitfieldRef.c b/llvm/test/CFrontend/2003-08-20-BadBitfieldRef.c new file mode 100644 index 00000000000..58cf1bc334c --- /dev/null +++ b/llvm/test/CFrontend/2003-08-20-BadBitfieldRef.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void foo() +{ + char *ap; + ap[1] == '-' && ap[2] == 0; +} + diff --git a/llvm/test/CFrontend/2003-08-20-PrototypeMismatch.c b/llvm/test/CFrontend/2003-08-20-PrototypeMismatch.c new file mode 100644 index 00000000000..8358a2f6fd0 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-20-PrototypeMismatch.c @@ -0,0 +1,15 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + + +static int foo(int); + +static int foo(C) +char C; +{ + return C; +} + +void test() { + foo(7); +} diff --git a/llvm/test/CFrontend/2003-08-20-vfork-bug.c b/llvm/test/CFrontend/2003-08-20-vfork-bug.c new file mode 100644 index 00000000000..575bfd6c194 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-20-vfork-bug.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +extern int vfork(void); +test() { + vfork(); +} diff --git a/llvm/test/CFrontend/2003-08-21-BinOp-Type-Mismatch.c b/llvm/test/CFrontend/2003-08-21-BinOp-Type-Mismatch.c new file mode 100644 index 00000000000..8829652cb15 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-21-BinOp-Type-Mismatch.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct bar; + +void foo() +{ + unsigned int frame, focus; + (struct bar *) focus == (focus ? ((struct bar *) frame) : 0); +} + diff --git a/llvm/test/CFrontend/2003-08-21-StmtExpr.c b/llvm/test/CFrontend/2003-08-21-StmtExpr.c new file mode 100644 index 00000000000..878ed473487 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-21-StmtExpr.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +typedef struct { + unsigned long val; +} structty; + +void bar(structty new_mask); +static void foo() { + bar(({ structty mask; mask; })); +} + diff --git a/llvm/test/CFrontend/2003-08-21-WideString.c b/llvm/test/CFrontend/2003-08-21-WideString.c new file mode 100644 index 00000000000..0a833dcac54 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-21-WideString.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct { + int *name; +} syms = { L"NUL" }; diff --git a/llvm/test/CFrontend/2003-08-23-LocalUnionTest.c b/llvm/test/CFrontend/2003-08-23-LocalUnionTest.c new file mode 100644 index 00000000000..dc27802623a --- /dev/null +++ b/llvm/test/CFrontend/2003-08-23-LocalUnionTest.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + + +union foo { int X; }; + +int test(union foo* F) { + { + union foo { float X; } A; + } +} diff --git a/llvm/test/CFrontend/2003-08-29-BitFieldStruct.c b/llvm/test/CFrontend/2003-08-29-BitFieldStruct.c new file mode 100644 index 00000000000..8c303e8f2e0 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-29-BitFieldStruct.c @@ -0,0 +1,13 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} diff --git a/llvm/test/CFrontend/2003-08-29-HugeCharConst.c b/llvm/test/CFrontend/2003-08-29-HugeCharConst.c new file mode 100644 index 00000000000..a997994e91c --- /dev/null +++ b/llvm/test/CFrontend/2003-08-29-HugeCharConst.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void foo() { + unsigned char int_latin1[] = "f\200\372b\200\343\200\340"; +} diff --git a/llvm/test/CFrontend/2003-08-29-StructLayoutBug.c b/llvm/test/CFrontend/2003-08-29-StructLayoutBug.c new file mode 100644 index 00000000000..a5f6fb106ff --- /dev/null +++ b/llvm/test/CFrontend/2003-08-29-StructLayoutBug.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct foo { + unsigned int I:1; + unsigned char J[1]; + unsigned int K:1; + }; + +void test(struct foo *X) {} + diff --git a/llvm/test/CFrontend/2003-08-30-AggregateInitializer.c b/llvm/test/CFrontend/2003-08-30-AggregateInitializer.c new file mode 100644 index 00000000000..f5d5ca9d5e5 --- /dev/null +++ b/llvm/test/CFrontend/2003-08-30-AggregateInitializer.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o /dev/null + +// XFAIL: llvmgcc3 + +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 }; + + diff --git a/llvm/test/CFrontend/2003-08-30-LargeIntegerBitfieldMember.c b/llvm/test/CFrontend/2003-08-30-LargeIntegerBitfieldMember.c new file mode 100644 index 00000000000..f67aee4c10f --- /dev/null +++ b/llvm/test/CFrontend/2003-08-30-LargeIntegerBitfieldMember.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct foo { + unsigned int I:1; + unsigned char J[1][123]; + unsigned int K:1; + }; + +struct foo F; diff --git a/llvm/test/CFrontend/2003-09-18-BitfieldTests.c b/llvm/test/CFrontend/2003-09-18-BitfieldTests.c new file mode 100644 index 00000000000..3a7879bfb5c --- /dev/null +++ b/llvm/test/CFrontend/2003-09-18-BitfieldTests.c @@ -0,0 +1,30 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +typedef struct BF { + int A : 1; + char B; + int C : 13; +} BF; + +char *test1(BF *b) { + return &b->B; // Must be able to address non-bitfield +} + +void test2(BF *b) { // Increment and decrement operators + b->A++; + --b->C; +} + +void test3(BF *b) { + b->C = 12345; // Store +} + +int test4(BF *b) { + return b->C; // Load +} + +void test5(BF *b, int i) { // array ref + b[i].C = 12345; +} + diff --git a/llvm/test/CFrontend/2003-09-30-StructLayout.c b/llvm/test/CFrontend/2003-09-30-StructLayout.c new file mode 100644 index 00000000000..3a4016606ec --- /dev/null +++ b/llvm/test/CFrontend/2003-09-30-StructLayout.c @@ -0,0 +1,18 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2003-10-02-UnionLValueError.c b/llvm/test/CFrontend/2003-10-02-UnionLValueError.c new file mode 100644 index 00000000000..732f93a7731 --- /dev/null +++ b/llvm/test/CFrontend/2003-10-02-UnionLValueError.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +union U{ + int i[8]; + char s[80]; +}; + +void format_message(char *buffer, union U *u) { + sprintf(buffer, u->s); +} + diff --git a/llvm/test/CFrontend/2003-10-06-NegateExprType.c b/llvm/test/CFrontend/2003-10-06-NegateExprType.c new file mode 100644 index 00000000000..02386031b71 --- /dev/null +++ b/llvm/test/CFrontend/2003-10-06-NegateExprType.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +extern int A[10]; +void Func(int *B) { + B - &A[5]; +} + diff --git a/llvm/test/CFrontend/2003-10-09-UnionInitializerBug.c b/llvm/test/CFrontend/2003-10-09-UnionInitializerBug.c new file mode 100644 index 00000000000..90dbd37f0d6 --- /dev/null +++ b/llvm/test/CFrontend/2003-10-09-UnionInitializerBug.c @@ -0,0 +1,17 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +struct Foo { + unsigned a; + unsigned b; + unsigned c; +}; + +struct Bar { + union { + void **a; + struct Foo b; + }u; +}; + +struct Bar test = {0}; + diff --git a/llvm/test/CFrontend/2003-10-28-ident.c b/llvm/test/CFrontend/2003-10-28-ident.c new file mode 100644 index 00000000000..9911dfd1ffe --- /dev/null +++ b/llvm/test/CFrontend/2003-10-28-ident.c @@ -0,0 +1,4 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +#ident "foo" diff --git a/llvm/test/CFrontend/2003-10-29-AsmRename.c b/llvm/test/CFrontend/2003-10-29-AsmRename.c new file mode 100644 index 00000000000..5750cedd026 --- /dev/null +++ b/llvm/test/CFrontend/2003-10-29-AsmRename.c @@ -0,0 +1,22 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} diff --git a/llvm/test/CFrontend/2003-11-01-C99-CompoundLiteral.c b/llvm/test/CFrontend/2003-11-01-C99-CompoundLiteral.c new file mode 100644 index 00000000000..a0aa69858cf --- /dev/null +++ b/llvm/test/CFrontend/2003-11-01-C99-CompoundLiteral.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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 }, }; +} + diff --git a/llvm/test/CFrontend/2003-11-01-EmptyStructCrash.c b/llvm/test/CFrontend/2003-11-01-EmptyStructCrash.c new file mode 100644 index 00000000000..fb6993bb209 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-01-EmptyStructCrash.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +typedef struct { } the_coolest_struct_in_the_world; +extern the_coolest_struct_in_the_world xyzzy; +void *foo() { return &xyzzy; } + diff --git a/llvm/test/CFrontend/2003-11-01-GlobalUnionInit.c b/llvm/test/CFrontend/2003-11-01-GlobalUnionInit.c new file mode 100644 index 00000000000..be7788d1abb --- /dev/null +++ b/llvm/test/CFrontend/2003-11-01-GlobalUnionInit.c @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +union bdflush_param { + struct { int x; } b_un; + int y[1]; +} bdf_prm = {{30}}; + diff --git a/llvm/test/CFrontend/2003-11-03-AddrArrayElement.c.tr b/llvm/test/CFrontend/2003-11-03-AddrArrayElement.c.tr new file mode 100644 index 00000000000..ed3fc1a6cb4 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-03-AddrArrayElement.c.tr @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr + +// 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) { + return &Global[i]; +} + diff --git a/llvm/test/CFrontend/2003-11-04-EmptyStruct.c b/llvm/test/CFrontend/2003-11-04-EmptyStruct.c new file mode 100644 index 00000000000..c7a01641591 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-04-EmptyStruct.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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) { }; } + diff --git a/llvm/test/CFrontend/2003-11-04-OutOfMemory.c b/llvm/test/CFrontend/2003-11-04-OutOfMemory.c new file mode 100644 index 00000000000..6a42e160f27 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-04-OutOfMemory.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void schedule_timeout(signed long timeout) +{ + switch (timeout) + { + case ((long)(~0UL>>1)): break; + } +} diff --git a/llvm/test/CFrontend/2003-11-08-PointerSubNotGetelementptr.c.tr b/llvm/test/CFrontend/2003-11-08-PointerSubNotGetelementptr.c.tr new file mode 100644 index 00000000000..443dfbdb37f --- /dev/null +++ b/llvm/test/CFrontend/2003-11-08-PointerSubNotGetelementptr.c.tr @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr + +char *test(char* C) { + return C-1; // Should turn into a GEP +} + +int *test2(int* I) { + return I-1; +} diff --git a/llvm/test/CFrontend/2003-11-12-VoidString.c b/llvm/test/CFrontend/2003-11-12-VoidString.c new file mode 100644 index 00000000000..db2e84bbbbc --- /dev/null +++ b/llvm/test/CFrontend/2003-11-12-VoidString.c @@ -0,0 +1,4 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void query_newnamebuf(void) { ((void)"query_newnamebuf"); } + diff --git a/llvm/test/CFrontend/2003-11-13-TypeSafety.c.tr b/llvm/test/CFrontend/2003-11-13-TypeSafety.c.tr new file mode 100644 index 00000000000..128b767e22d --- /dev/null +++ b/llvm/test/CFrontend/2003-11-13-TypeSafety.c.tr @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep getelementptr + +int *test(int *X, int Y) { + return X + Y; +} diff --git a/llvm/test/CFrontend/2003-11-16-StaticArrayInit.c b/llvm/test/CFrontend/2003-11-16-StaticArrayInit.c new file mode 100644 index 00000000000..2b42e38dc9a --- /dev/null +++ b/llvm/test/CFrontend/2003-11-16-StaticArrayInit.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void bar () { + static char x[10]; + static char *xend = x + 10; +} + + diff --git a/llvm/test/CFrontend/2003-11-18-CondExprLValue.c b/llvm/test/CFrontend/2003-11-18-CondExprLValue.c new file mode 100644 index 00000000000..ec000a443d9 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-18-CondExprLValue.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2003-11-19-AddressOfRegister.c.tr b/llvm/test/CFrontend/2003-11-19-AddressOfRegister.c.tr new file mode 100644 index 00000000000..ae37cbd2511 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-19-AddressOfRegister.c.tr @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -xc %s -S -o /dev/null 2>&1 | not grep 'warning' + +struct item { + short delta[4]; +}; + +int TEST(int nt) { + register struct item *aa; + aa[nt].delta; + return 1; +} + diff --git a/llvm/test/CFrontend/2003-11-19-BitFieldArray.c b/llvm/test/CFrontend/2003-11-19-BitFieldArray.c new file mode 100644 index 00000000000..9d54112e86e --- /dev/null +++ b/llvm/test/CFrontend/2003-11-19-BitFieldArray.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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]; +} + diff --git a/llvm/test/CFrontend/2003-11-20-Bitfields.c b/llvm/test/CFrontend/2003-11-20-Bitfields.c new file mode 100644 index 00000000000..c9ea0dc7f1e --- /dev/null +++ b/llvm/test/CFrontend/2003-11-20-Bitfields.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2003-11-20-ComplexDivision.c b/llvm/test/CFrontend/2003-11-20-ComplexDivision.c new file mode 100644 index 00000000000..cd548c0313f --- /dev/null +++ b/llvm/test/CFrontend/2003-11-20-ComplexDivision.c @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +int test() { + __complex__ double C; + double D; + C / D; +} diff --git a/llvm/test/CFrontend/2003-11-20-UnionBitfield.c b/llvm/test/CFrontend/2003-11-20-UnionBitfield.c new file mode 100644 index 00000000000..12e7df5890a --- /dev/null +++ b/llvm/test/CFrontend/2003-11-20-UnionBitfield.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} + diff --git a/llvm/test/CFrontend/2003-11-26-PointerShift.c b/llvm/test/CFrontend/2003-11-26-PointerShift.c new file mode 100644 index 00000000000..079f6903a23 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-26-PointerShift.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2003-11-27-ConstructorCast.c b/llvm/test/CFrontend/2003-11-27-ConstructorCast.c new file mode 100644 index 00000000000..3780e7a4b97 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-27-ConstructorCast.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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}} }; +} diff --git a/llvm/test/CFrontend/2003-11-27-UnionCtorInitialization.c b/llvm/test/CFrontend/2003-11-27-UnionCtorInitialization.c new file mode 100644 index 00000000000..472b5915853 --- /dev/null +++ b/llvm/test/CFrontend/2003-11-27-UnionCtorInitialization.c @@ -0,0 +1,16 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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}} }; +} diff --git a/llvm/test/CFrontend/2003-12-14-ExternInlineSupport.c.tr b/llvm/test/CFrontend/2003-12-14-ExternInlineSupport.c.tr new file mode 100644 index 00000000000..fb92ec773c1 --- /dev/null +++ b/llvm/test/CFrontend/2003-12-14-ExternInlineSupport.c.tr @@ -0,0 +1,3 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | not grep dead_function + +extern __inline__ void dead_function() {} diff --git a/llvm/test/CFrontend/2004-01-01-UnknownInitSize.c b/llvm/test/CFrontend/2004-01-01-UnknownInitSize.c new file mode 100644 index 00000000000..f9367bec514 --- /dev/null +++ b/llvm/test/CFrontend/2004-01-01-UnknownInitSize.c @@ -0,0 +1,15 @@ +// RUN: %llvmgcc -S %s -o /dev/null +// XFAIL: llvmgcc3 + +/* + * 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}}; + diff --git a/llvm/test/CFrontend/2004-01-08-ExternInlineRedefine.c b/llvm/test/CFrontend/2004-01-08-ExternInlineRedefine.c new file mode 100644 index 00000000000..b3907ee9933 --- /dev/null +++ b/llvm/test/CFrontend/2004-01-08-ExternInlineRedefine.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +extern __inline long int +__strtol_l (int a) +{ + return 0; +} + +long int +__strtol_l (int a) +{ + return 0; +} diff --git a/llvm/test/CFrontend/2004-02-12-LargeAggregateCopy.c.tr b/llvm/test/CFrontend/2004-02-12-LargeAggregateCopy.c.tr new file mode 100644 index 00000000000..b3c9bcf3810 --- /dev/null +++ b/llvm/test/CFrontend/2004-02-12-LargeAggregateCopy.c.tr @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memcpy + +struct X { int V[10000]; }; +struct X Global1, Global2; +void test() { + Global2 = Global1; +} + diff --git a/llvm/test/CFrontend/2004-02-13-BuiltinFrameReturnAddress.c.tr b/llvm/test/CFrontend/2004-02-13-BuiltinFrameReturnAddress.c.tr new file mode 100644 index 00000000000..288593c5da0 --- /dev/null +++ b/llvm/test/CFrontend/2004-02-13-BuiltinFrameReturnAddress.c.tr @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep 'llvm.*address' | wc -l | grep 4 + +void *test1() { + return __builtin_return_address(1); +} +void *test2() { + return __builtin_frame_address(0); +} diff --git a/llvm/test/CFrontend/2004-02-13-IllegalVararg.c.tr b/llvm/test/CFrontend/2004-02-13-IllegalVararg.c.tr new file mode 100644 index 00000000000..1f3eded0cdc --- /dev/null +++ b/llvm/test/CFrontend/2004-02-13-IllegalVararg.c.tr @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -xc %s -c -o - | llc + +#include <stdarg.h> + +float test(int X, ...) { + va_list ap; + float F; + va_start(ap, X); + F = va_arg(ap, float); + return F; +} diff --git a/llvm/test/CFrontend/2004-02-13-Memset.c.tr b/llvm/test/CFrontend/2004-02-13-Memset.c.tr new file mode 100644 index 00000000000..ca0db7a18b2 --- /dev/null +++ b/llvm/test/CFrontend/2004-02-13-Memset.c.tr @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memset | wc -l | grep 3 + +void test(int* X, char *Y) { + memset(X, 4, 1000); + bzero(Y, 100); +} diff --git a/llvm/test/CFrontend/2004-02-13-StringInit.c.tr b/llvm/test/CFrontend/2004-02-13-StringInit.c.tr new file mode 100644 index 00000000000..0dfe5577008 --- /dev/null +++ b/llvm/test/CFrontend/2004-02-13-StringInit.c.tr @@ -0,0 +1,8 @@ +// XFAIL: * +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep llvm.memset + +char test(int X) { + char str[10000] = "abc"; // tail should be memset. + return str[X]; +} + diff --git a/llvm/test/CFrontend/2004-02-14-ZeroInitializer.c.tr b/llvm/test/CFrontend/2004-02-14-ZeroInitializer.c.tr new file mode 100644 index 00000000000..bede9078741 --- /dev/null +++ b/llvm/test/CFrontend/2004-02-14-ZeroInitializer.c.tr @@ -0,0 +1,4 @@ +// RUN: %llvmgcc -xc %s -S -o - | grep zeroinitializer + +int X[1000]; + diff --git a/llvm/test/CFrontend/2004-02-20-Builtins.c.tr b/llvm/test/CFrontend/2004-02-20-Builtins.c.tr new file mode 100644 index 00000000000..82b7dc1f34c --- /dev/null +++ b/llvm/test/CFrontend/2004-02-20-Builtins.c.tr @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -O3 -xc %s -c -o - | llvm-dis | not grep builtin + +void zsqrtxxx(float num) { + num = sqrt(num); +} + diff --git a/llvm/test/CFrontend/2004-03-07-ComplexDivEquals.c b/llvm/test/CFrontend/2004-03-07-ComplexDivEquals.c new file mode 100644 index 00000000000..b1da5805412 --- /dev/null +++ b/llvm/test/CFrontend/2004-03-07-ComplexDivEquals.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +void test(__complex__ double D, double X) { + D /= X; +} diff --git a/llvm/test/CFrontend/2004-03-07-ExternalConstant.c.tr b/llvm/test/CFrontend/2004-03-07-ExternalConstant.c.tr new file mode 100644 index 00000000000..b8e13a35548 --- /dev/null +++ b/llvm/test/CFrontend/2004-03-07-ExternalConstant.c.tr @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep constant + +extern const int a[]; // 'a' should be marked constant even though it's external! +int foo () { + return a[0]; +} + diff --git a/llvm/test/CFrontend/2004-03-09-LargeArrayInitializers.c b/llvm/test/CFrontend/2004-03-09-LargeArrayInitializers.c new file mode 100644 index 00000000000..335c5684870 --- /dev/null +++ b/llvm/test/CFrontend/2004-03-09-LargeArrayInitializers.c @@ -0,0 +1,32 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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]; +} diff --git a/llvm/test/CFrontend/2004-03-15-SimpleIndirectGoto.c b/llvm/test/CFrontend/2004-03-15-SimpleIndirectGoto.c new file mode 100644 index 00000000000..ad7221e96a0 --- /dev/null +++ b/llvm/test/CFrontend/2004-03-15-SimpleIndirectGoto.c @@ -0,0 +1,23 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +int code[]={0,0,0,0,1}; +void foo(int x) { + volatile int b; + b = 0xffffffff; +} +void bar(int *pc) { + static const void *l[] = {&&lab0, &&end}; + + foo(0); + goto *l[*pc]; + lab0: + foo(0); + pc++; + goto *l[*pc]; + end: + return; +} +int main() { + bar(code); + return 0; +} diff --git a/llvm/test/CFrontend/2004-03-16-AsmRegisterCrash.c b/llvm/test/CFrontend/2004-03-16-AsmRegisterCrash.c new file mode 100644 index 00000000000..6ad1cd48f3c --- /dev/null +++ b/llvm/test/CFrontend/2004-03-16-AsmRegisterCrash.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +int foo() { + register int X __asm__("ebx"); + return X; +} diff --git a/llvm/test/CFrontend/2004-05-07-VarArrays.c b/llvm/test/CFrontend/2004-05-07-VarArrays.c new file mode 100644 index 00000000000..20412983e90 --- /dev/null +++ b/llvm/test/CFrontend/2004-05-07-VarArrays.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +int foo(int len, char arr[][len], int X) { + return arr[X][0]; +} diff --git a/llvm/test/CFrontend/2004-05-21-IncompleteEnum.c b/llvm/test/CFrontend/2004-05-21-IncompleteEnum.c new file mode 100644 index 00000000000..3636ca74293 --- /dev/null +++ b/llvm/test/CFrontend/2004-05-21-IncompleteEnum.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +void test(enum foo *X) { +} + diff --git a/llvm/test/CFrontend/2004-06-08-OpaqueStructArg.c b/llvm/test/CFrontend/2004-06-08-OpaqueStructArg.c new file mode 100644 index 00000000000..ede811c3898 --- /dev/null +++ b/llvm/test/CFrontend/2004-06-08-OpaqueStructArg.c @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + struct fu; + void foo(struct fu); + void bar() { + foo; + } diff --git a/llvm/test/CFrontend/2004-06-17-UnorderedBuiltins.c b/llvm/test/CFrontend/2004-06-17-UnorderedBuiltins.c new file mode 100644 index 00000000000..5e02e7f325a --- /dev/null +++ b/llvm/test/CFrontend/2004-06-17-UnorderedBuiltins.c @@ -0,0 +1,24 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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); +} diff --git a/llvm/test/CFrontend/2004-06-17-UnorderedCompares.c.tr b/llvm/test/CFrontend/2004-06-17-UnorderedCompares.c.tr new file mode 100644 index 00000000000..f91ed6687ce --- /dev/null +++ b/llvm/test/CFrontend/2004-06-17-UnorderedCompares.c.tr @@ -0,0 +1,21 @@ +// RUN: %llvmgcc -xc -std=c99 %s -c -o - | llvm-dis | grep -v llvm.isunordered | not grep call + +#include <math.h> + +_Bool A, B, C, D, E, F; +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); +} +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); +} diff --git a/llvm/test/CFrontend/2004-06-18-VariableLengthArrayOfStructures.c b/llvm/test/CFrontend/2004-06-18-VariableLengthArrayOfStructures.c new file mode 100644 index 00000000000..e474a13b37f --- /dev/null +++ b/llvm/test/CFrontend/2004-06-18-VariableLengthArrayOfStructures.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + + +struct S { }; + +int xxxx(int a) { + struct S comps[a]; + comps[0]; +} + diff --git a/llvm/test/CFrontend/2004-07-06-FunctionCast.c b/llvm/test/CFrontend/2004-07-06-FunctionCast.c new file mode 100644 index 00000000000..169f7403642 --- /dev/null +++ b/llvm/test/CFrontend/2004-07-06-FunctionCast.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null + +static int unused_func(void) { + return 1; +} + +int foo(void) { + (void)unused_func; /* avoid compiler warning */ + return 2; +} diff --git a/llvm/test/CFrontend/2004-08-06-LargeStructTest.c b/llvm/test/CFrontend/2004-08-06-LargeStructTest.c new file mode 100644 index 00000000000..b0413b4b0ce --- /dev/null +++ b/llvm/test/CFrontend/2004-08-06-LargeStructTest.c @@ -0,0 +1,19 @@ +// RUN: %llvmgcc -S %s -o - | llvm-as -f -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; +} diff --git a/llvm/test/CFrontend/2004-11-25-UnnamedBitfieldPadding.c b/llvm/test/CFrontend/2004-11-25-UnnamedBitfieldPadding.c new file mode 100644 index 00000000000..b3f4a829a9e --- /dev/null +++ b/llvm/test/CFrontend/2004-11-25-UnnamedBitfieldPadding.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc -S %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; diff --git a/llvm/test/CFrontend/2004-11-27-InvalidConstantExpr.c b/llvm/test/CFrontend/2004-11-27-InvalidConstantExpr.c new file mode 100644 index 00000000000..54468a56450 --- /dev/null +++ b/llvm/test/CFrontend/2004-11-27-InvalidConstantExpr.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc %s -S -o - | not grep 'foo\* sub' +// This should not produce a subtrace constantexpr of a pointer +struct foo { + int Y; + char X[100]; +} F; + +int test(char *Y) { + return Y - F.X; +} diff --git a/llvm/test/CFrontend/2004-11-27-StaticFunctionRedeclare.c b/llvm/test/CFrontend/2004-11-27-StaticFunctionRedeclare.c new file mode 100644 index 00000000000..abc6fbbff67 --- /dev/null +++ b/llvm/test/CFrontend/2004-11-27-StaticFunctionRedeclare.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc -S 2004-11-27-StaticFunctionRedeclare.c -o - | gccas | llvm-dis | not grep 'declare int.*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) {} diff --git a/llvm/test/CFrontend/2004-11-27-VariableSizeInStructure.c b/llvm/test/CFrontend/2004-11-27-VariableSizeInStructure.c new file mode 100644 index 00000000000..bd63ae3b012 --- /dev/null +++ b/llvm/test/CFrontend/2004-11-27-VariableSizeInStructure.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc %s -S -o /dev/null + +// GCC allows variable sized arrays in structures, crazy! + +// This is PR360. + +int sub1(int i, char *pi) { + typedef int foo[i]; + struct bar {foo f1; int f2;} *p = (struct bar *) pi; + return p->f2; +} diff --git a/llvm/test/CFrontend/2005-01-02-ConstantInits.c b/llvm/test/CFrontend/2005-01-02-ConstantInits.c new file mode 100644 index 00000000000..735278e0f93 --- /dev/null +++ b/llvm/test/CFrontend/2005-01-02-ConstantInits.c @@ -0,0 +1,24 @@ +// RUN: %llvmgcc %s -S -o - + +// This tests all kinds of hard cases with initializers and +// array subscripts. This corresponds to PR487. + +struct X { int a[2]; }; + +int test() { + static int i23 = (int) &(((struct X *)0)->a[1]); + return i23; +} + +int i = (int) &( ((struct X *)0) -> a[1]); + +int Arr[100]; + +int foo(int i) { return bar(&Arr[49])+bar(&Arr[i]); } +int foo2(int i) { + static const int *X = &Arr[49]; + static int i23 = (int) &( ((struct X *)0) -> a[0]); + int *P = Arr; + ++P; + return bar(Arr+i); +} diff --git a/llvm/test/CFrontend/2005-01-02-PointerDifference.c.tr b/llvm/test/CFrontend/2005-01-02-PointerDifference.c.tr new file mode 100644 index 00000000000..a351da2ed8c --- /dev/null +++ b/llvm/test/CFrontend/2005-01-02-PointerDifference.c.tr @@ -0,0 +1,3 @@ +// RUN: %llvmgcc -xc %s -c -o - | llvm-dis | grep -v div + +int Diff(int *P, int *Q) { return P-Q; } diff --git a/llvm/test/CFrontend/2005-01-02-VAArgError-ICE.c b/llvm/test/CFrontend/2005-01-02-VAArgError-ICE.c new file mode 100644 index 00000000000..26a2da08172 --- /dev/null +++ b/llvm/test/CFrontend/2005-01-02-VAArgError-ICE.c @@ -0,0 +1,10 @@ +// This file is erroneous, but should not cause the compiler to ICE. +// PR481 +// RUN: %llvmgcc %s -S -o /dev/null 2>&1 | not grep 'internal compiler error' + +#include <stdarg.h> +int flags(int a, int b, ...) { + va_list args; + va_start(args,a); // not the last named arg + foo(args); +} diff --git a/llvm/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c b/llvm/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c new file mode 100644 index 00000000000..63bb251c3f0 --- /dev/null +++ b/llvm/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c @@ -0,0 +1,15 @@ +// RUN: %llvmgcc %s -o /dev/null -S +// Note: +// We fail this on Sparc because the C library seems to be missing complex.h +// and the corresponding C99 complex support. +// +// We could modify the test to use only GCC extensions, but I don't know if +// that would change the nature of the test. +// +// XFAIL: sparc + +#include <complex.h> + +int foo(complex float c) { + return creal(c); +} diff --git a/llvm/test/CFrontend/2005-02-27-MarkGlobalConstant.c b/llvm/test/CFrontend/2005-02-27-MarkGlobalConstant.c new file mode 100644 index 00000000000..100c79c82bf --- /dev/null +++ b/llvm/test/CFrontend/2005-02-27-MarkGlobalConstant.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -xc %s -S -o - | grep 'internal constant ' + +// The synthetic global made by the CFE for big initializer should be marked +// constant. + +void bar(); +void foo() { + char Blah[] = "asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd"; + bar(Blah); +} diff --git a/llvm/test/CFrontend/2005-03-05-OffsetOfHack.c b/llvm/test/CFrontend/2005-03-05-OffsetOfHack.c new file mode 100644 index 00000000000..8df7231df6a --- /dev/null +++ b/llvm/test/CFrontend/2005-03-05-OffsetOfHack.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o - + +struct s { + unsigned long int field[0]; +}; + +#define OFFS \ + (((char *) &((struct s *) 0)->field[0]) - (char *) 0) + +int foo[OFFS]; + + diff --git a/llvm/test/CFrontend/2005-03-06-OffsetOfStructCrash.c b/llvm/test/CFrontend/2005-03-06-OffsetOfStructCrash.c new file mode 100644 index 00000000000..91e68628023 --- /dev/null +++ b/llvm/test/CFrontend/2005-03-06-OffsetOfStructCrash.c @@ -0,0 +1,14 @@ +// RUN: %llvmgcc %s -S -o - + +struct Y {}; +struct XXX { + struct Y F; +}; + +void test1() { + (int)&((struct XXX*)(((void *)0)))->F; +} + +void test2() { + &((struct XXX*)(((void *)0)))->F; +} diff --git a/llvm/test/CFrontend/2005-03-11-Prefetch.c b/llvm/test/CFrontend/2005-03-11-Prefetch.c new file mode 100644 index 00000000000..bf7965304f1 --- /dev/null +++ b/llvm/test/CFrontend/2005-03-11-Prefetch.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.prefetch + +void foo(int *P) { + __builtin_prefetch(P); + __builtin_prefetch(P, 1); +} diff --git a/llvm/test/CFrontend/2005-04-09-ComplexOps.c b/llvm/test/CFrontend/2005-04-09-ComplexOps.c new file mode 100644 index 00000000000..2962b745534 --- /dev/null +++ b/llvm/test/CFrontend/2005-04-09-ComplexOps.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc %s -S -o - + +#include <math.h> +#define I 1.0iF + +double __complex test(double X) { return ~-(X*I); } + +_Bool EQ(double __complex A, double __complex B) { return A == B; } +_Bool NE(double __complex A, double __complex B) { return A != B; } diff --git a/llvm/test/CFrontend/2005-05-06-CountBuiltins.c b/llvm/test/CFrontend/2005-05-06-CountBuiltins.c new file mode 100644 index 00000000000..cfc691a670b --- /dev/null +++ b/llvm/test/CFrontend/2005-05-06-CountBuiltins.c @@ -0,0 +1,17 @@ +// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | not grep 'call.*__builtin' + +int G, H, I; +void foo(int P) { + G = __builtin_clz(P); + H = __builtin_ctz(P); + I = __builtin_popcount(P); +} + +long long g, h, i; +void fooll(float P) { + g = __builtin_clzll(P); + g = __builtin_clzll(P); + h = __builtin_ctzll(P); + i = __builtin_popcountll(P); +} + diff --git a/llvm/test/CFrontend/2005-05-10-GlobalUnionInit.c b/llvm/test/CFrontend/2005-05-10-GlobalUnionInit.c new file mode 100644 index 00000000000..443064c921d --- /dev/null +++ b/llvm/test/CFrontend/2005-05-10-GlobalUnionInit.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc %s -S -o - + +union A { // { uint } + union B { double *C; } D; +} E = { { (double*)12312 } }; + diff --git a/llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c b/llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c new file mode 100644 index 00000000000..0b49f52b1f5 --- /dev/null +++ b/llvm/test/CFrontend/2005-06-15-ExpandGotoInternalProblem.c @@ -0,0 +1,13 @@ +// RUN: %llvmgcc -std=c99 %s -S -o - | gccas -o /dev/null +// PR580 + +int X, Y; +int foo() { + int i; + for (i=0; i<100; i++ ) + { + break; + i = ( X || Y ) ; + } +} + diff --git a/llvm/test/CFrontend/2005-07-20-SqrtNoErrno.c b/llvm/test/CFrontend/2005-07-20-SqrtNoErrno.c new file mode 100644 index 00000000000..fd976a67933 --- /dev/null +++ b/llvm/test/CFrontend/2005-07-20-SqrtNoErrno.c @@ -0,0 +1,7 @@ +// RUN: %llvmgcc %s -S -o - -fno-math-errno | gccas | llvm-dis | grep llvm.sqrt +#include <math.h> + +float foo(float X) { + // Check that this compiles to llvm.sqrt when errno is ignored. + return sqrtf(X); +} diff --git a/llvm/test/CFrontend/2005-07-26-UnionInitCrash.c b/llvm/test/CFrontend/2005-07-26-UnionInitCrash.c new file mode 100644 index 00000000000..563278a9c68 --- /dev/null +++ b/llvm/test/CFrontend/2005-07-26-UnionInitCrash.c @@ -0,0 +1,3 @@ +// PR607 +// RUN: %llvmgcc %s -S -o - +union { char bytes[8]; double alignment; }EQ1 = {0,0,0,0,0,0,0,0}; diff --git a/llvm/test/CFrontend/2005-07-28-IncorrectWeakGlobal.c b/llvm/test/CFrontend/2005-07-28-IncorrectWeakGlobal.c new file mode 100644 index 00000000000..1a8c409439c --- /dev/null +++ b/llvm/test/CFrontend/2005-07-28-IncorrectWeakGlobal.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc %s -S -o - | grep TheGlobal | not grep weak + +extern int TheGlobal; +int foo() { return TheGlobal; } +int TheGlobal = 1; diff --git a/llvm/test/CFrontend/2005-09-20-ComplexConstants.c b/llvm/test/CFrontend/2005-09-20-ComplexConstants.c new file mode 100644 index 00000000000..34dd64a3cb7 --- /dev/null +++ b/llvm/test/CFrontend/2005-09-20-ComplexConstants.c @@ -0,0 +1,5 @@ +// RUN: %llvmgcc %s -S -o - && \ +// RUN: %llvmgcc %s -S -o - | llvm-as -o /dev/null -f + +const double _Complex x[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; + diff --git a/llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c b/llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c new file mode 100644 index 00000000000..06600fa84af --- /dev/null +++ b/llvm/test/CFrontend/2005-09-24-AsmUserPrefix.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc %s -S -o - | gccas && +// RUN: %llvmgcc %s -S -o - | gccas | llc && +// RUN: %llvmgcc %s -S -o - | gccas | llc | not grep _foo2 + +void foo() __asm__("foo2"); + +void bar() { + foo(); +} diff --git a/llvm/test/CFrontend/2005-09-24-BitFieldCrash.c b/llvm/test/CFrontend/2005-09-24-BitFieldCrash.c new file mode 100644 index 00000000000..b4c85ffb2d8 --- /dev/null +++ b/llvm/test/CFrontend/2005-09-24-BitFieldCrash.c @@ -0,0 +1,33 @@ +// RUN: %llvmgcc %s -S -o - + +struct tree_common {}; + +struct tree_int_cst { + struct tree_common common; + struct tree_int_cst_lowhi { + unsigned long long low; + long long high; + } int_cst; +}; + +enum XXX { yyy }; + +struct tree_function_decl { + struct tree_common common; + long long locus, y; + __extension__ enum XXX built_in_class : 2; + +}; + + +union tree_node { + struct tree_int_cst int_cst; + struct tree_function_decl function_decl; +}; + + +void foo (union tree_node * decl) { + decl->function_decl.built_in_class != 0; +} + + diff --git a/llvm/test/CFrontend/2005-10-18-VariableSizedElementCrash.c b/llvm/test/CFrontend/2005-10-18-VariableSizedElementCrash.c new file mode 100644 index 00000000000..290e7cd4cc9 --- /dev/null +++ b/llvm/test/CFrontend/2005-10-18-VariableSizedElementCrash.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc %s -S -o - +// XFAIL: llvmgcc3 + +int sub1(int i, char *pi) { + typedef int foo[i]; + struct bar {foo f1; int f2:3; int f3:4} *p = (struct bar *) pi; + xxx(p->f1); + return p->f3; +} + diff --git a/llvm/test/CFrontend/2005-12-04-AttributeUsed.c b/llvm/test/CFrontend/2005-12-04-AttributeUsed.c new file mode 100644 index 00000000000..a3da1c3e641 --- /dev/null +++ b/llvm/test/CFrontend/2005-12-04-AttributeUsed.c @@ -0,0 +1,7 @@ +// RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X + +int X __attribute__((used)); +int Y; + +__attribute__((used)) void foo() {} + diff --git a/llvm/test/CFrontend/2005-12-04-DeclarationLineNumbers.c b/llvm/test/CFrontend/2005-12-04-DeclarationLineNumbers.c new file mode 100644 index 00000000000..ab176c7ee13 --- /dev/null +++ b/llvm/test/CFrontend/2005-12-04-DeclarationLineNumbers.c @@ -0,0 +1,23 @@ +// RUN: %llvmgcc %s -S -g -o - | grep 'llvm.dbg.stoppoint.*i32 14' +// PR664: ensure that line #'s are emitted for declarations + + +short test(short br_data_0, +short br_data_1, +short br_data_2, +short br_data_3, +short br_data_4, +short br_data_5, +short br_data_6, +short br_data_7) { + +short sm07 = br_data_0 + br_data_7; +short sm16 = br_data_1 + br_data_6; +short sm25 = br_data_2 + br_data_5; +short sm34 = br_data_3 + br_data_4; +short s0734 = sm07 + sm34; +short s1625 = sm16 + sm25; + +return s0734 + s1625; +} + diff --git a/llvm/test/CFrontend/2006-01-13-Includes.c b/llvm/test/CFrontend/2006-01-13-Includes.c new file mode 100644 index 00000000000..b7fd750c29e --- /dev/null +++ b/llvm/test/CFrontend/2006-01-13-Includes.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc %s -g -S -o - | gccas | llvm-dis | grep "test/Regression/CFrontend" +// PR676 + +#include <stdio.h> + +void test() { + printf("Hello World\n"); +} diff --git a/llvm/test/CFrontend/2006-01-13-StackSave.c b/llvm/test/CFrontend/2006-01-13-StackSave.c new file mode 100644 index 00000000000..b606c290e0e --- /dev/null +++ b/llvm/test/CFrontend/2006-01-13-StackSave.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep llvm.stacksave +// XFAIL: llvmgcc3 + +// PR691 + +void test(int N) { + int i; + for (i = 0; i < N; ++i) { + int VLA[i]; + external(VLA); + } +} diff --git a/llvm/test/CFrontend/2006-01-16-BitCountIntrinsicsUnsigned.c b/llvm/test/CFrontend/2006-01-16-BitCountIntrinsicsUnsigned.c new file mode 100644 index 00000000000..645f40c04b1 --- /dev/null +++ b/llvm/test/CFrontend/2006-01-16-BitCountIntrinsicsUnsigned.c @@ -0,0 +1,9 @@ +// RUN: %llvmgcc -S %s -o - | grep 'llvm.ctlz.i32(i32' +// RUNMEIFWEHADSIGNEDTYPES: %llvmgcc -S %s -o - | not grep 'llvm.ctlz.i32(i32' + +unsigned t2(unsigned X) { + return __builtin_clz(X); +} +int t1(int X) { + return __builtin_clz(X); +} diff --git a/llvm/test/CFrontend/2006-01-23-FileScopeAsm.c b/llvm/test/CFrontend/2006-01-23-FileScopeAsm.c new file mode 100644 index 00000000000..7ee4a5160d4 --- /dev/null +++ b/llvm/test/CFrontend/2006-01-23-FileScopeAsm.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep foo[12345] | wc -l | grep 5 +// XFAIL: llvmgcc3 + +__asm__ ("foo1"); +__asm__ ("foo2"); +__asm__ ("foo3"); +__asm__ ("foo4"); +__asm__ ("foo5"); diff --git a/llvm/test/CFrontend/2006-03-03-MissingInitializer.c b/llvm/test/CFrontend/2006-03-03-MissingInitializer.c new file mode 100644 index 00000000000..5a2acb588c0 --- /dev/null +++ b/llvm/test/CFrontend/2006-03-03-MissingInitializer.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc %s -S -o - | gccas | llvm-dis | grep nate | grep 'global i32 0' + +struct X { int *XX; int Y;}; + +void foo() { + static int nate = 0; + struct X bob = { &nate, 14 }; + bar(&bob); +} + diff --git a/llvm/test/CFrontend/2006-03-16-VectorCtor.c b/llvm/test/CFrontend/2006-03-16-VectorCtor.c new file mode 100644 index 00000000000..0ef4e695563 --- /dev/null +++ b/llvm/test/CFrontend/2006-03-16-VectorCtor.c @@ -0,0 +1,12 @@ +// Test that basic generic vector support works + +// RUN: %llvmgcc %s -S -o - +// XFAIL: llvmgcc3 + +typedef int v4si __attribute__ ((__vector_size__ (16))); +void test(v4si *P, v4si *Q, float X) { + *P = (v4si){ X, X, X, X } * *Q; +} + +v4si G = (v4si){ 0.1, 1.2, 4.2, 17.2 }; + diff --git a/llvm/test/CFrontend/2006-03-17-KnRMismatch.c b/llvm/test/CFrontend/2006-03-17-KnRMismatch.c new file mode 100644 index 00000000000..19391122fca --- /dev/null +++ b/llvm/test/CFrontend/2006-03-17-KnRMismatch.c @@ -0,0 +1,8 @@ +// RUN: %llvmgcc %s -S -o - + +void regnode(int op); + +void regnode(op) +char op; +{ +} diff --git a/llvm/test/CFrontend/2006-05-01-AppleAlignmentPragma.c b/llvm/test/CFrontend/2006-05-01-AppleAlignmentPragma.c new file mode 100644 index 00000000000..c9050aa9e4e --- /dev/null +++ b/llvm/test/CFrontend/2006-05-01-AppleAlignmentPragma.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o - + +#ifdef __APPLE__ +/* test that X is layed out correctly when this pragma is used. */ +#pragma options align=mac68k +#endif + +struct S { + unsigned A; + unsigned short B; +} X; + diff --git a/llvm/test/CFrontend/2006-05-19-SingleEltReturn.c b/llvm/test/CFrontend/2006-05-19-SingleEltReturn.c new file mode 100644 index 00000000000..70c94c62052 --- /dev/null +++ b/llvm/test/CFrontend/2006-05-19-SingleEltReturn.c @@ -0,0 +1,23 @@ +// Test returning a single element aggregate value containing a double. +// RUN: %llvmgcc %s -S -o - + +struct X { + double D; +}; + +struct Y { + struct X x; +}; + +struct Y bar(); + +void foo(struct Y *P) { + *P = bar(); +} + +struct Y bar() { + struct Y a; + a.x.D = 0; + return a; +} + diff --git a/llvm/test/CFrontend/2006-07-31-PR854.c b/llvm/test/CFrontend/2006-07-31-PR854.c new file mode 100644 index 00000000000..1aa9a4cd933 --- /dev/null +++ b/llvm/test/CFrontend/2006-07-31-PR854.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o - +// PR854 +// XFAIL: llvmgcc3 + struct kernel_symbol { + unsigned long value; + }; + unsigned long loops_per_jiffy = (1<<12); + static const char __kstrtab_loops_per_jiffy[] +__attribute__((section("__ksymtab_strings"))) = "loops_per_jiffy"; + static const struct kernel_symbol __ksymtab_loops_per_jiffy +__attribute__((__used__)) __attribute__((section("__ksymtab"))) = { (unsigned +long)&loops_per_jiffy, __kstrtab_loops_per_jiffy }; diff --git a/llvm/test/CFrontend/2006-09-11-BitfieldRefCrash.c b/llvm/test/CFrontend/2006-09-11-BitfieldRefCrash.c new file mode 100644 index 00000000000..d06cc3afbf3 --- /dev/null +++ b/llvm/test/CFrontend/2006-09-11-BitfieldRefCrash.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o - +// PR906 + +struct state_struct { + unsigned long long phys_frame: 50; + unsigned valid : 2; +} s; + +int mem_access(struct state_struct *p) { + return p->valid; +} + diff --git a/llvm/test/CFrontend/2006-09-18-fwrite-cast-crash.c b/llvm/test/CFrontend/2006-09-18-fwrite-cast-crash.c new file mode 100644 index 00000000000..8ba20520714 --- /dev/null +++ b/llvm/test/CFrontend/2006-09-18-fwrite-cast-crash.c @@ -0,0 +1,13 @@ +// RUN: %llvmgcc %s -S -o - +// PR910 + +struct l_struct_2E_FILE { char x; }; +unsigned fwrite(signed char *, unsigned , unsigned , signed char *); +static signed char str301[39]; +static void Usage(signed char *ltmp_611_6) { + struct l_struct_2E_FILE *ltmp_6202_16; + unsigned ltmp_6203_92; + ltmp_6203_92 = /*tail*/ ((unsigned (*) (signed char *, unsigned , unsigned , +struct l_struct_2E_FILE *))(void*)fwrite)((&(str301[0u])), 38u, 1u, ltmp_6202_16); +} + diff --git a/llvm/test/CFrontend/2006-09-21-IncompleteElementType.c b/llvm/test/CFrontend/2006-09-21-IncompleteElementType.c new file mode 100644 index 00000000000..1899f363e25 --- /dev/null +++ b/llvm/test/CFrontend/2006-09-21-IncompleteElementType.c @@ -0,0 +1,3 @@ +// RUN: %llvmgcc %s -S -o /dev/null 2>&1 | not grep 'internal compiler error' + +struct A X[(927 - 37) / sizeof(struct A)]; diff --git a/llvm/test/CFrontend/2006-09-25-DebugFilename.c.tr b/llvm/test/CFrontend/2006-09-25-DebugFilename.c.tr new file mode 100644 index 00000000000..c59e9ad2ce7 --- /dev/null +++ b/llvm/test/CFrontend/2006-09-25-DebugFilename.c.tr @@ -0,0 +1,5 @@ +// RUN: %llvmgcc -xc %s -S -o /dev/null 2>&1 | grep fluffy | grep '2006-09-25-DebugFilename.c.tr' +#include "2006-09-25-DebugFilename.h" +int func1() { return hfunc1(); } +int func2() { fluffy; return hfunc1(); } + diff --git a/llvm/test/CFrontend/2006-09-25-DebugFilename.h b/llvm/test/CFrontend/2006-09-25-DebugFilename.h new file mode 100644 index 00000000000..9b03666b3c2 --- /dev/null +++ b/llvm/test/CFrontend/2006-09-25-DebugFilename.h @@ -0,0 +1,6 @@ +extern int exfunc(int a); + +static inline int hfunc1() +{ + return exfunc(1); +} diff --git a/llvm/test/CFrontend/2006-09-28-SimpleAsm.c b/llvm/test/CFrontend/2006-09-28-SimpleAsm.c new file mode 100644 index 00000000000..7b16712ff24 --- /dev/null +++ b/llvm/test/CFrontend/2006-09-28-SimpleAsm.c @@ -0,0 +1,12 @@ +// RUN: %llvmgcc %s -S -o /dev/null && +// RUN: %llvmgcc %s -S -o - | grep 'ext: xorl %eax, eax; movl' && +// RUN: %llvmgcc %s -S -o - | grep 'nonext: xorl %eax, %eax; mov' +// XFAIL: llvmgcc3 +// PR924 + +void bar() { + // Extended asm + asm volatile ("ext: xorl %%eax, eax; movl eax, fs; movl eax, gs %%blah %= %% " : : "r"(1)); + // Non-extended asm. + asm volatile ("nonext: xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs %%blah %= %% "); +} diff --git a/llvm/test/CFrontend/2006-10-30-ArrayCrash.c b/llvm/test/CFrontend/2006-10-30-ArrayCrash.c new file mode 100644 index 00000000000..09464dd3a06 --- /dev/null +++ b/llvm/test/CFrontend/2006-10-30-ArrayCrash.c @@ -0,0 +1,17 @@ +// RUN: %llvmgcc -O3 -S -o - %s +// PR954, PR911 + +extern void foo(); + +struct S { + short f1[3]; + unsigned int f2 : 1; +}; + +void bar() +{ + struct S *A; + + if (A->f2) + foo(); +} diff --git a/llvm/test/CFrontend/2006-12-14-ordered_expr.c b/llvm/test/CFrontend/2006-12-14-ordered_expr.c new file mode 100644 index 00000000000..090b989affc --- /dev/null +++ b/llvm/test/CFrontend/2006-12-14-ordered_expr.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc -O3 -S %s -o - | grep 'fcmp ord float %X, %Y' + +int test2(float X, float Y) { + return !__builtin_isunordered(X, Y); +} + diff --git a/llvm/test/CFrontend/2007-01-06-KNR-Proto.c b/llvm/test/CFrontend/2007-01-06-KNR-Proto.c new file mode 100644 index 00000000000..eb2f25482d9 --- /dev/null +++ b/llvm/test/CFrontend/2007-01-06-KNR-Proto.c @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -S -o - -emit-llvm %s +// PR1083 + +int svc_register (void (*dispatch) (int)); + +int svc_register (dispatch) + void (*dispatch) (); +{ +} + diff --git a/llvm/test/CFrontend/attribute_constructor.c b/llvm/test/CFrontend/attribute_constructor.c new file mode 100644 index 00000000000..b2f7c9b19fc --- /dev/null +++ b/llvm/test/CFrontend/attribute_constructor.c @@ -0,0 +1,6 @@ +// RUN: %llvmgcc %s -c -o - | llvm-dis | grep llvm.global_ctors + +void foo() __attribute__((constructor)); +void foo() { + bar(); +} diff --git a/llvm/test/CFrontend/bit-accurate-int.c b/llvm/test/CFrontend/bit-accurate-int.c new file mode 100644 index 00000000000..a2138bc7d26 --- /dev/null +++ b/llvm/test/CFrontend/bit-accurate-int.c @@ -0,0 +1,35 @@ +// RUN: %llvmgcc -S %s -o - /dev/null +// XFAIL: * + +#define ATTR_BITS(N) __attribute__((bitwidth(N))) + +typedef int ATTR_BITS( 4) My04BitInt; +typedef int ATTR_BITS(16) My16BitInt; +typedef int ATTR_BITS(17) My17BitInt; +typedef int ATTR_BITS(37) My37BitInt; +typedef int ATTR_BITS(65) My65BitInt; + +struct MyStruct { + My04BitInt i4Field; + short ATTR_BITS(12) i12Field; + long ATTR_BITS(17) i17Field; + My37BitInt i37Field; +}; + +My37BitInt doit( short ATTR_BITS(23) num) { + My17BitInt i; + struct MyStruct strct; + int bitsize1 = sizeof(My17BitInt); + int __attribute__((bitwidth(9))) j; + int bitsize2 = sizeof(j); + int result = bitsize1 + bitsize2; + strct.i17Field = result; + result += sizeof(struct MyStruct); + return result; +} + +int +main ( int argc, char** argv) +{ + return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc); +} diff --git a/llvm/test/CFrontend/cast-to-bool.c b/llvm/test/CFrontend/cast-to-bool.c new file mode 100644 index 00000000000..e0f48daa731 --- /dev/null +++ b/llvm/test/CFrontend/cast-to-bool.c @@ -0,0 +1,16 @@ +// RUN: %llvmgcc -S %s -o - | grep 'trunc.*to bool' +// RUN: %llvmgcc -S %s -o - | llvm-as | llc -march=x86 | grep 'test.*1' +int +main ( int argc, char** argv) +{ + int i; + int result = 1; + for (i = 2; i <= 3; i++) + { + if ((i & 1) == 0) + { + result = result + 17; + } + } + return result; +} diff --git a/llvm/test/CFrontend/dg.exp b/llvm/test/CFrontend/dg.exp new file mode 100644 index 00000000000..142de8a6c8f --- /dev/null +++ b/llvm/test/CFrontend/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm-dg.exp + +llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version diff --git a/llvm/test/CFrontend/extern-weak.c b/llvm/test/CFrontend/extern-weak.c new file mode 100644 index 00000000000..ce9d77241b3 --- /dev/null +++ b/llvm/test/CFrontend/extern-weak.c @@ -0,0 +1,11 @@ +// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak && +// RUN: %llvmgcc -O3 -S -o - -emit-llvm | llvm-as | llc + +#ifndef __linux__ +void foo() __attribute__((weak_import)); +#else +void foo() __attribute__((weak)); +#endif + +void bar() { foo(); } + diff --git a/llvm/test/CFrontend/hidden-visibility.c b/llvm/test/CFrontend/hidden-visibility.c new file mode 100644 index 00000000000..2bfecac2620 --- /dev/null +++ b/llvm/test/CFrontend/hidden-visibility.c @@ -0,0 +1,3 @@ +// RUN: %llvmgcc %s -emit-llvm -S -o - | grep 'hidden global' + +int X __attribute__ ((__visibility__ ("hidden"))) = 123; |

