1 /* Verify that strlen doesn't (inadvertently) use the size of an array
2 of char pointers to put an upper bound on the length of the strings
5 { dg-options "-O2 -Wall -fdump-tree-optimized" } */
16 /* The longest string stored in EAA is 15 characters. */
17 if (__builtin_strlen (*p
) > 14)
19 extern void eaa_ok (void);
23 if (__builtin_strlen (*p
) > 15)
25 extern void eaa_fail (void);
30 /* { dg-final { scan-tree-dump-times "eaa_ok" 1 "optimized" } }
31 { dg-final { scan-tree-dump-not "eaa_fail" "optimized" } } */
39 if (*p
&& __builtin_strlen (*p
) > 123)
41 extern void epa_ok (void);
46 /* { dg-final { scan-tree-dump-times "epa_ok" 1 "optimized" } } */
55 if (*p
&& __builtin_strlen (*p
) > 123)
57 extern void spa_ok ();
62 /* { dg-final { scan-tree-dump-times "spa_ok" 1 "optimized" } } */
65 void sink (void*, ...);
69 /* Make believe even the static array SA may be non-zero. */