1 /* When the specified length exceeds one of the arguments of the call to memcmp,
2    the call to memcmp should NOT be inlined.  */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -Wno-stringop-overflow" } */
5 
6 typedef struct { char s[8]; int x; } S;
7 
8 __attribute__ ((noinline)) int
f1(S * s)9 f1 (S * s)
10 {
11   int result = 0;
12   result += __builtin_memcmp (s->s, "a", 3);
13   return result;
14 }
15 
16 __attribute__ ((noinline)) int
f2(char * p)17 f2 (char *p)
18 {
19   int result = 0;
20   result += __builtin_memcmp (p, "a", 3);
21   return result;
22 }
23 
main(void)24 int main (void)
25 {
26   S ss = {{'a','b','c'}, 2};
27   char *s = "abcd";
28 
29   if (f1 (&ss) < 0 || f2 (s) < 0)
30     __builtin_abort ();
31 
32   return 0;
33 
34 }
35 
36 /* { dg-final { scan-assembler-times "memcmp" 2 } } */
37