Hi!

This PR has been fixed by r10-7237-g4e3d3e40726e1b68bf52fa205c68495124ea60b8
already but we didn't have a comparable testcase.

Tested on x86_64-linux -m32/-m64, committed to trunk as obvious.

2020-04-01  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/94436
        * gcc.dg/pr94436.c: New test.

--- gcc/testsuite/gcc.dg/pr94436.c.jj
+++ gcc/testsuite/gcc.dg/pr94436.c
@@ -0,0 +1,13 @@
+/* PR middle-end/94436 */
+/* { dg-do compile } */
+/* { dg-options "-Wincompatible-pointer-types" } */
+
+struct S { int s; };
+int foo (struct S *);
+
+int
+bar (void)
+{
+  int s = 0;
+  return foo ((struct S *) ((char *) &s - (char *) &((struct S *) 0)->s));     
/* { dg-bogus "from incompatible pointer type" } */
+}

        Jakub

Reply via email to