./:
[official-gcc.git] / gcc / testsuite / gcc.c-torture / compile / 20031023-1.c
blob67f8ea9181ada88786a0b046b54676be362505e2
1 #ifndef ASIZE
2 # define ASIZE 0x10000000000UL
3 #endif
5 #include <limits.h>
7 #if LONG_MAX < 8 * ASIZE
8 # undef ASIZE
9 # define ASIZE 4096
10 #endif
12 extern void abort (void);
14 int __attribute__((noinline))
15 foo (const char *s)
17 if (!s)
18 return 1;
19 if (s[0] != 'a')
20 abort ();
21 s += ASIZE - 1;
22 if (s[0] != 'b')
23 abort ();
24 return 0;
27 int (*fn) (const char *) = foo;
29 int __attribute__((noinline))
30 bar (void)
32 char s[ASIZE];
33 s[0] = 'a';
34 s[ASIZE - 1] = 'b';
35 foo (s);
36 foo (s);
37 return 0;
40 int __attribute__((noinline))
41 baz (long i)
43 if (i)
44 return fn (0);
45 else
47 char s[ASIZE];
48 s[0] = 'a';
49 s[ASIZE - 1] = 'b';
50 foo (s);
51 foo (s);
52 return fn (0);
56 int
57 main (void)
59 if (bar ())
60 abort ();
61 if (baz (0) != 1)
62 abort ();
63 if (baz (1) != 1)
64 abort ();
65 return 0;