* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / nonnull-2.c
blobebd17a21f030985d44fdec770341c6b05580033f
1 /* Test for the bad usage of "nonnull" function attribute parms. */
2 /* { dg-do compile } */
3 /* { dg-options "-Wnonnull-compare" } */
5 void bar (char **);
7 __attribute__((nonnull (1, 3))) int
8 foo (char *cp1, char *cp2, char *cp3, char *cp4)
10 if (cp1 == (char *) 0) /* { dg-warning "nonnull argument" "cp1 compared to NULL" } */
11 return 1;
13 cp1 = cp2;
14 if (cp1 == (char *) 0) /* { dg-bogus "nonnull argument" } */
15 return 2;
17 if (!cp4) /* { dg-bogus "nonnull argument" } */
18 return 3;
20 char **p = &cp3;
21 bar (p);
22 if (cp3 == (char *) 0) /* { dg-bogus "nonnull argument" } */
23 return 4;
25 return 5;