1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Warray-bounds" } */
4 int foo(unsigned int state
, unsigned char * p
, unsigned int p_len
)
6 static char const pattern
[] = "abcd";
7 static unsigned const pattern_length
= sizeof(pattern
) - 1;
13 if (state
< pattern_length
&&
14 p_len
== (pattern_length
- state
) &&
15 (!__builtin_constant_p(p_len
) ?
16 __builtin_memcmp(p
, pattern
+ state
, p_len
) :
17 ((unsigned char*)p
)[6] == ((unsigned char*)pattern
+ state
)[6] /* { dg-bogus "array bounds" } */