Add testcase for already fixed PR [PR94436]
authorJakub Jelinek <jakub@redhat.com>
Wed, 1 Apr 2020 12:33:32 +0000 (14:33 +0200)
committerJakub Jelinek <jakub@redhat.com>
Wed, 1 Apr 2020 12:33:32 +0000 (14:33 +0200)
2020-04-01  Jakub Jelinek  <jakub@redhat.com>

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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr94436.c [new file with mode: 0644]

index 49a45f2854e78c2f5d320ba547b52ec015830cd4..11ba84a00e05c95de989be55dd907bdc0259567f 100644 (file)
@@ -1,5 +1,8 @@
 2020-04-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/94436
+       * gcc.dg/pr94436.c: New test.
+
        PR middle-end/94423
        * gcc.dg/ubsan/pr94423.c: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr94436.c b/gcc/testsuite/gcc.dg/pr94436.c
new file mode 100644 (file)
index 0000000..345b595
--- /dev/null
@@ -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" } */
+}