1 /* PR tree-optimization/83671 - fix for false positive reported by
2 -Wstringop-overflow does not work with inlining
3 Verify that the length the empty string is folded to zero even at -O1
4 regardless of offset into it.
5 Also verify that the length of a non-empty string isn't folded given
8 { dg-options "-O1 -fdump-tree-optimized" } */
10 #include "strlenopt.h"
12 inline unsigned length (const char *s
)
14 return __builtin_strlen (s
);
17 void check_length_cst (int i
)
19 unsigned len
= length (&""[i
]);
25 void check_length_var (int i
)
27 unsigned len
= length (&"1"[i
]);
33 /* { dg-final { scan-tree-dump-times "abort" 1 "optimized" } }
34 { dg-final { scan-tree-dump-times "strlen" 1 "optimized" } } */