1 /* PR tree-optimization/91914 - Invalid strlen folding for offset into struct
3 { dg-options "-O2 -Wall" } */
8 : (__builtin_printf ("%s:%i: assertion failed: %s\n", \
9 __FILE__, __LINE__, #expr), \
12 extern __SIZE_TYPE__
strlen (const char*);
16 char s1
[sizeof ("1")];
17 char s2
[sizeof ("12")];
18 char s3
[sizeof ("123")];
19 char s4
[sizeof ("1234")];
20 char s5
[sizeof ("12345")];
23 static const struct stringpool_t stringpool_contents
=
25 "1", "12", "123", "1234", "12345"
28 #define stringpool ((const char *) &stringpool_contents)
30 volatile int i0
= 0, i2
= 2, i5
= 5, i9
= 9, i14
= 14;
34 /* These shouldn't trigger warnings. */
35 assert (strlen (stringpool
) == 1);
36 assert (strlen (stringpool
+ 2) == 2);
37 assert (strlen (stringpool
+ 5) == 3);
38 assert (strlen (stringpool
+ 9) == 4);
39 assert (strlen (stringpool
+ 14) == 5);
41 assert (strlen (stringpool
+ i0
) == 1);
42 assert (strlen (stringpool
+ i2
) == 2);
43 assert (strlen (stringpool
+ i5
) == 3);
44 assert (strlen (stringpool
+ i9
) == 4);
45 assert (strlen (stringpool
+ i14
) == 5);