1 /* PR middle-end/95189 - memcmp being wrongly stripped like strcmp
3 { dg-options "-O2 -Wall" } */
6 #define ABCDEF_H "abcdef\0h"
7 #define ABCDEFGHIJKLMN_P "abcdefghijklmn\0p"
10 char abcdef_h
[] = ABCDEF_H
;
12 extern int strncmp (const char*, const char*, __SIZE_TYPE__
);
14 __attribute__((noipa
)) void sink (const void *p
, ...) { (void)&p
; }
16 #define strncmp(a, b, n) (sink (a, b), strncmp (a, b, n))
22 zero
+= strncmp (ab_d
, AB_D
, 1);
23 zero
+= strncmp (ab_d
, AB_D
, 2);
24 zero
+= strncmp (ab_d
, AB_D
, 3);
25 zero
+= strncmp (ab_d
, AB_D
, 4);
26 zero
+= strncmp (ab_d
, AB_D
, 5);
28 zero
+= strncmp (ab_d
, ABCDEF_H
, 1);
29 zero
+= strncmp (ab_d
, ABCDEF_H
, 2);
31 zero
+= strncmp (abcdef_h
, AB_D
, 2);
33 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 2);
34 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 3);
35 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 4);
36 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 5);
37 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 6);
38 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 7);
39 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 8);
40 zero
+= strncmp (abcdef_h
, ABCDEF_H
, 9);
47 neg
-= strncmp (ab_d
, ABCDEF_H
, 3) < 0;
48 neg
-= strncmp (ab_d
, ABCDEF_H
, 4) < 0;
49 neg
-= strncmp (ab_d
, ABCDEF_H
, 5) < 0;
50 neg
-= strncmp (ab_d
, ABCDEF_H
, 6) < 0;
51 neg
-= strncmp (ab_d
, ABCDEF_H
, 7) < 0;
52 neg
-= strncmp (ab_d
, ABCDEF_H
, 8) < 0;
53 neg
-= strncmp (ab_d
, ABCDEF_H
, 9) < 0;