+// 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;
+// 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]
//
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void *dlclose(void*);
void ap_os_dso_unload(void *handle)
+// 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 */
+// 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
+// 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
*/
+// 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
+// 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.
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/* test that locals are renamed with . notation */
void abc(void *);
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int test(int X) {
return X;
}
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/* GCC wasn't handling 64 bit constants right fixed */
void main() {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
double FOO = 17;
double BAR = 12.0;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
#include <string.h>
int test(char *X) {
+// 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.
*/
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct Connection_Type {
long to;
+// 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.
+// 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.
+// 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
+// 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"
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int printf(const char *, ...);
int foo();
+// 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.
*/
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct S {
int i;
short s1, s2;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct {
char p;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/* Make sure the frontend is correctly marking static stuff as internal! */
int X;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/* Testcase for when struct tag conflicts with typedef name... grr */
typedef struct foo {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
#include <stdio.h>
void test() {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
// Test list stuff
void *malloc(unsigned);
+// 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. */
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
// Test ?: in function calls
extern fp(int, char*);
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void *malloc(unsigned);
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
char auto_kibitz_list[100][20] = {
{"diepx"},
{"ferret"},
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
char * foo() { return "\\begin{"; }
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
union X {
void *B;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
union X;
struct Empty {};
union F {};
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int tcount;
void test(char *, const char*, int);
void foo() {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct
{
unsigned char type; /* Indicates, NORMAL, SUBNORMAL, etc. */
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef union {
long (*ap)[4];
+// 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
*/
+// 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 {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int foo(int *A, unsigned X) {
return A[X];
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct DWstruct {
char high, low;
+// 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");
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void foo() {}
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/* Provide Declarations */
#ifndef NULL
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
_Bool X = 0;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
const char *W = "foo";
const int X = 7;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
extern char algbrfile[9];
char algbrfile[9] = "abcdefgh";
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct
{
void *stack;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
// XFAIL: linux,sun,darwin
union foo {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
// XFAIL: *
/* It is unlikely that LLVM will ever support nested functions, but if it does,
here is a testcase. */
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct Blend_Map_Entry {
union {
float Colour[5];
+// 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);
}
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct min_info {
long offset;
unsigned file_attr;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/* This is apparently legal C.
*/
extern __inline__ void test() { }
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
#include <setjmp.h>
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct {
int op;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void foo()
{
char *ap;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
static int foo(int);
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
extern int vfork(void);
test() {
vfork();
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct bar;
void foo()
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct {
unsigned long val;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct {
int *name;
} syms = { L"NUL" };
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
union foo { int X; };
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct Word {
short bar;
short baz;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void foo() {
unsigned char int_latin1[] = "f\200\372b\200\343\200\340";
}
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct foo {
unsigned int I:1;
unsigned char J[1];
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
// XFAIL: linux,sun,darwin
struct istruct {
unsigned char C;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct foo {
unsigned int I:1;
unsigned char J[1][123];
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
typedef struct BF {
int A : 1;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
enum En {
ENUM_VAL
};
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
union U{
int i[8];
char s[80];
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
extern int A[10];
void Func(int *B) {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct Foo {
unsigned a;
unsigned b;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
#ident "foo"
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct foo { int X; };
struct bar { int Y; };
+// 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) {
+// 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; }
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
union bdflush_param {
struct { int x; } b_un;
int y[1];
+// 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) { }; }
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void schedule_timeout(signed long timeout)
{
switch (timeout)
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void query_newnamebuf(void) { ((void)"query_newnamebuf"); }
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void bar () {
static char x[10];
static char *xend = x + 10;
+// 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)
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct _GIOChannel {
int write_buf;
char partial_write_buf[6];
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct face_cachel {
unsigned int reverse :1;
unsigned char font_specified[1];
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int test() {
__complex__ double C;
double D;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct printf_spec {
unsigned int minus_flag:1;
char converter;
+// 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;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct i387_soft_struct {
long cwd;
};
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct i387_soft_struct {
long cwd;
long twd;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/*
* This regression test ensures that the C front end can compile initializers
* even when it cannot determine the size (as below).
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
extern __inline long int
__strtol_l (int a)
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
/*
* XFAIL: linux
*/
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void test(__complex__ double D, double X) {
D /= X;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
// Test that these initializers are handled efficiently
int test(int x) {
+// 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;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int foo() {
register int X __asm__("ebx");
return X;
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
int foo(int len, char arr[][len], int X) {
return arr[X][0];
}
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
void test(enum foo *X) {
}
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct fu;
void foo(struct fu);
void bar() {
+// 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) {
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
struct S { };
+// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null
+
static int unused_func(void) {
return 1;
}
+// 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) \