| 1 |
/* See 'gcc.target/nvptx/__builtin_alloca_0-1-O0.c'. |
| 2 |
{ dg-xfail-if TODO { nvptx-*-* && { ! nvptx_softstack } } { "-O0" } { "" } } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
|
| 6 |
extern __SIZE_TYPE__ strlen (const char *); |
| 7 |
void foo(char *str) |
| 8 |
{ |
| 9 |
int len2 = strlen (str); |
| 10 |
char *a = (char *) __builtin_alloca (0); |
| 11 |
char *b = (char *) __builtin_alloca (len2*3); |
| 12 |
|
| 13 |
if ((int) (a-b) < (len2*3)) |
| 14 |
{ |
| 15 |
#ifdef _WIN32 |
| 16 |
abort (); |
| 17 |
#endif |
| 18 |
return; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
static char * volatile argp = "pr36321.x"; |
| 23 |
|
| 24 |
int main(int argc, char **argv) |
| 25 |
{ |
| 26 |
foo (argp); |
| 27 |
return 0; |
| 28 |
} |
| 29 |
|