gcc/testsuite/gcc.c-torture/compile/pr42049.c
raw| 1 | /* PR middle-end/42049 */ |
| 2 | |
| 3 | extern char *strcpy (char *s1, const char *s2); |
| 4 | struct S { char s[4]; }; |
| 5 | |
| 6 | int |
| 7 | foo (int x, char **y) |
| 8 | { |
| 9 | char const *a; |
| 10 | char const *b; |
| 11 | struct S s[9]; |
| 12 | long i; |
| 13 | if (x > 1) |
| 14 | a = y[1]; |
| 15 | else |
| 16 | a = "abc"; |
| 17 | if (x > 2) |
| 18 | b = y[2]; |
| 19 | else |
| 20 | b = "def"; |
| 21 | strcpy (s[0].s, a); |
| 22 | strcpy (s[1].s, b); |
| 23 | for (i = 2; i < x - 2 && i < 8; i++) |
| 24 | strcpy (s[i].s, y[i + 1]); |
| 25 | s[i].s[0] = '\0'; |
| 26 | return 0; |
| 27 | } |