diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106537-1.c b/gcc/testsuite/gcc.c-torture/compile/pr106537-1.c index 3f3b06577d5..b67b6090dc3 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr106537-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr106537-1.c @@ -25,9 +25,11 @@ int xdp_context (struct xdp_md *xdp) return 3; if (metadata + 1 <= data) /* { dg-warning "comparison of distinct pointer types" } */ return 4; - if (metadata + 1 == data) /* { dg-warning "comparison of distinct pointer types" } */ + /* Note that it is ok to check for equality or inequality betewen void + pointers and any other non-function pointers. */ + if ((int*) (metadata + 1) == (long*) data) /* { dg-warning "comparison of distinct pointer types" } */ return 5; - if (metadata + 1 != data) /* { dg-warning "comparison of distinct pointer types" } */ + if ((int*) metadata + 1 != (long*) data) /* { dg-warning "comparison of distinct pointer types" } */ return 5; return 1; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106537-2.c b/gcc/testsuite/gcc.c-torture/compile/pr106537-2.c index 6876adf3aab..d4223c25c94 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr106537-2.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr106537-2.c @@ -23,9 +23,11 @@ int xdp_context (struct xdp_md *xdp) return 3; if (metadata + 1 <= data) /* { dg-warning "comparison of distinct pointer types" } */ return 4; - if (metadata + 1 == data) /* { dg-warning "comparison of distinct pointer types" } */ + /* Note that it is ok to check for equality or inequality betewen void + pointers and any other non-function pointers. */ + if ((int*) (metadata + 1) == (long*) data) /* { dg-warning "comparison of distinct pointer types" } */ return 5; - if (metadata + 1 != data) /* { dg-warning "comparison of distinct pointer types" } */ + if ((int*) metadata + 1 != (long*) data) /* { dg-warning "comparison of distinct pointer types" } */ return 5; return 1;