| 1 |
/* PR tree-optimization/91570 - ICE in get_range_strlen_dynamic on |
| 2 |
a conditional of two strings |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall" } */ |
| 5 |
|
| 6 |
extern char a[], b[]; |
| 7 |
|
| 8 |
/* Test case from comment #0 on the bug. */ |
| 9 |
|
| 10 |
void comment_0 (int i) |
| 11 |
{ |
| 12 |
a[0] = 0; |
| 13 |
b[0] = '1'; |
| 14 |
|
| 15 |
const char *p = i ? b : a; |
| 16 |
|
| 17 |
if (__builtin_snprintf (0, 0, "%s", p) < 4) |
| 18 |
__builtin_abort (); |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
/* Test case from comment #2 on the bug. */ |
| 23 |
|
| 24 |
void comment_2 (char *s) |
| 25 |
{ |
| 26 |
char *t = __builtin_strrchr (s, '/'); |
| 27 |
__builtin_strcat (s, ".SIF"); |
| 28 |
t = t ? t : s; |
| 29 |
__builtin_printf ("%s", t); |
| 30 |
} |