| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-strlen" } */ |
| 3 |
|
| 4 |
typedef struct { char s[8]; int x; } S; |
| 5 |
|
| 6 |
extern int max_i; |
| 7 |
|
| 8 |
int f_param (S s) |
| 9 |
{ |
| 10 |
int result = 0; |
| 11 |
for (int i = 0; i < max_i; i++) |
| 12 |
result += __builtin_strcmp (s.s, "abc") != 0 ? 2 : 1; |
| 13 |
return result; |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
S s; |
| 18 |
|
| 19 |
int f_object (void) |
| 20 |
{ |
| 21 |
int result = 0; |
| 22 |
for (int i = 0; i < max_i; i++) |
| 23 |
result += __builtin_strcmp (s.s, "abc") != 0 ? 2 : 1; |
| 24 |
return result; |
| 25 |
} |
| 26 |
|
| 27 |
/* { dg-final { scan-tree-dump-times "cmp_eq \\(" 2 "strlen1" } } */ |