1 /* PR tree-optimization/78450 - strlen(s) return value can be assumed
2 to be less than the size of s
4 { dg-options "-O2 -fdump-tree-optimized" } */
8 extern char a7
[7], a6
[6], a5
[5], a4
[4], a3
[3], a2
[2], a1
[1];
9 extern char a0
[0]; /* Intentionally not tested here. */
10 extern char ax
[]; /* Same. */
12 extern void failure_on_line (int);
14 #define TEST_FAIL(line) \
16 failure_on_line (line); \
20 if (!(expr)) TEST_FAIL (__LINE__); else (void)0
23 void test_array (void)
25 T (strlen (a7
) < sizeof a7
);
26 T (strlen (a6
) < sizeof a6
);
27 T (strlen (a5
) < sizeof a5
);
28 T (strlen (a4
) < sizeof a4
);
29 T (strlen (a3
) < sizeof a3
);
31 /* The following two calls are folded too early which defeats
32 the strlen() optimization.
34 T (strlen (a1) == 0); */
37 /* { dg-final { scan-tree-dump-not "failure_on_line" "optimized" } } */