testsuite: Add testcase for already fixed PR [PR94436]

Message ID 20200401123630.GJ2212@tucnak
State New
Headers show
Series
  • testsuite: Add testcase for already fixed PR [PR94436]
Related show

Commit Message

Jakub Jelinek via Gcc-patches April 1, 2020, 12:36 p.m.
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  <jakub@redhat.com>

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


	Jakub

Patch

--- 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" } */
+}