1 /* Declaration of the frame size doesn't work on ptx. */ 2 /* { dg-require-effective-target untyped_assembly } */ 3 /* { dg-require-effective-target indirect_calls } */ 4 5 #ifndef ASIZE 6 # define ASIZE 0x10000000000UL 7 #endif 8 9 #include <limits.h> 10 11 #if LONG_MAX < 8 * ASIZE 12 # undef ASIZE 13 # define ASIZE 4096 14 #endif 15 16 extern void abort (void); 17 18 int __attribute__((noinline)) foo(const char * s)19foo (const char *s) 20 { 21 if (!s) 22 return 1; 23 if (s[0] != 'a') 24 abort (); 25 s += ASIZE - 1; 26 if (s[0] != 'b') 27 abort (); 28 return 0; 29 } 30 31 int (*fn) (const char *) = foo; 32 33 int __attribute__((noinline)) bar(void)34bar (void) 35 { 36 char s[ASIZE]; 37 s[0] = 'a'; 38 s[ASIZE - 1] = 'b'; 39 foo (s); 40 foo (s); 41 return 0; 42 } 43 44 int __attribute__((noinline)) baz(long i)45baz (long i) 46 { 47 if (i) 48 return fn (0); 49 else 50 { 51 char s[ASIZE]; 52 s[0] = 'a'; 53 s[ASIZE - 1] = 'b'; 54 foo (s); 55 foo (s); 56 return fn (0); 57 } 58 } 59 60 int main(void)61main (void) 62 { 63 if (bar ()) 64 abort (); 65 if (baz (0) != 1) 66 abort (); 67 if (baz (1) != 1) 68 abort (); 69 return 0; 70 } 71