blob: 980a8a45047096e8e3cd1d66880008ef6f3b541f [file] [log] [blame]
Chris Lattner38c42722002-07-14 23:48:42 +00001/* These are random tests that I used when working on the GCC frontend
2 originally. */
3
4// test floating point comparison!
5int floatcomptest(double *X, double *Y, float *x, float *y) {
6 return *X < *Y || *x < *y;
7}
8
9extern void *malloc(unsigned);
10
11// Exposed a bug
12void *memset_impl(void *dstpp, int c, unsigned len) {
13 long long int dstp = (long long int) dstpp;
14
15 while (dstp % 4 != 0)
16 {
17 ((unsigned char *) dstp)[0] = c;
18 dstp += 1;
19 len -= 1;
20 }
21 return dstpp;
22}
23
24// TEST problem with signed/unsigned versions of the same constants being shared
25// incorrectly!
26//
27static char *temp;
28static int remaining;
29static char *localmalloc(int size) {
30 char *blah;
31
32 if (size>remaining)
33 {
34 temp = (char *) malloc(32768);
35 remaining = 32768;
36 return temp;
37 }
38 return 0;
39}
40
41typedef struct { double X; double Y; int Z; } PBVTest;
42
43PBVTest testRetStruct(float X, double Y, int Z) {
44 PBVTest T = { X, Y, Z };
45 return T;
46}
47PBVTest testRetStruct2(void); // external func no inlining
48
49
50double CallRetStruct(float X, double Y, int Z) {
51 PBVTest T = testRetStruct2();
52 return T.X+X+Y+Z;
53}
54
55