1 /* PR tree-optimization/88659 - ICE in maybe_warn_nonstring_arg
2    { dg-do compile }
3    { dg-options "-O0 -Wall" }  */
4 
5 const char a[5] = "1234";
6 
cst_idx_cst_bnd(void)7 int cst_idx_cst_bnd (void)
8 {
9   return __builtin_strnlen (&a[1], 0);
10 }
11 
var_idx_cst_bnd(void)12 int var_idx_cst_bnd (void)
13 {
14   int i = 1;
15   return __builtin_strnlen (&a[i], 0);
16 }
17 
phi_idx_cst_bnd(int i)18 int phi_idx_cst_bnd (int i)
19 {
20   return __builtin_strnlen (&a[i ? 1 : 2], 0);
21 }
22 
unk_idx_cst_bnd(int i)23 int unk_idx_cst_bnd (int i)
24 {
25   return __builtin_strnlen (&a[i], 0);
26 }
27 
cst_idx_var_bnd(void)28 int cst_idx_var_bnd (void)
29 {
30   int n = 0;
31   return __builtin_strnlen (&a[1], n);
32 }
33 
cst_idx_phi_bnd(int n)34 int cst_idx_phi_bnd (int n)
35 {
36   return __builtin_strnlen (&a[1], n ? 1 : 2);
37 }
38 
cst_idx_unk_bnd(int n)39 int cst_idx_unk_bnd (int n)
40 {
41   return __builtin_strnlen (&a[1], n);
42 }
43