| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O1 -fdump-tree-fab1" } */ |
| 3 |
|
| 4 |
/* Check that we fold strlen of equally long strings, and that we do not |
| 5 |
fail to terminate when there is a nontrivial cycle in the corresponding |
| 6 |
ssa graph. */ |
| 7 |
|
| 8 |
extern __SIZE_TYPE__ strlen (const char *); |
| 9 |
extern void bar (__SIZE_TYPE__); |
| 10 |
extern int bla (void); |
| 11 |
|
| 12 |
void foo(int i) |
| 13 |
{ |
| 14 |
char *s = "abcde"; |
| 15 |
|
| 16 |
if (i) |
| 17 |
{ |
| 18 |
s = "defgh"; |
| 19 |
goto middle; |
| 20 |
} |
| 21 |
|
| 22 |
start: |
| 23 |
|
| 24 |
bla (); |
| 25 |
|
| 26 |
middle: |
| 27 |
|
| 28 |
if (bla ()) |
| 29 |
goto start; |
| 30 |
|
| 31 |
bar (strlen (s)); |
| 32 |
} |
| 33 |
|
| 34 |
/* There should be no calls to strlen. */ |
| 35 |
/* { dg-final { scan-tree-dump-times "strlen" 0 "fab1"} } */ |