This patch fixes the tests for PR 106537 (support for
-W[no]-compare-distinct-pointer-types) which were expecting the
warning when checking for equality/inequality of void pointers with
non-function pointers.
gcc/testsuite/ChangeLog:
PR c/106537
* gcc.c-torture/compile/pr106537-1.c: Comparing void pointers to
non-function pointers is legit.
* gcc.c-torture/compile/pr106537-2.c: Likewise.
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;
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;