From e899d4b71255b9ae096a7ecd31a61fc76f200019 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 1 Apr 2020 14:33:32 +0200 Subject: [PATCH] Add testcase for already fixed PR [PR94436] 2020-04-01 Jakub Jelinek PR middle-end/94436 * gcc.dg/pr94436.c: New test. --- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr94436.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr94436.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49a45f2854e..11ba84a00e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2020-04-01 Jakub Jelinek + 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 index 00000000000..345b5958a19 --- /dev/null +++ b/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" } */ +} -- 2.30.2