aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/gcc.dg/pr39464.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr39464.c b/gcc/testsuite/gcc.dg/pr39464.c
new file mode 100644
index 0000000..cd74540
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr39464.c
@@ -0,0 +1,19 @@
+/* PR c/39464 */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+typedef int T __attribute__((may_alias));
+typedef unsigned int U __attribute__((may_alias));
+
+void
+foo (void *p)
+{
+ T *a = (int *) p; /* { dg-warning "initialization from incompatible pointer type" } */
+ int *b = (T *) p; /* { dg-warning "initialization from incompatible pointer type" } */
+ U *c = (unsigned int *) p; /* { dg-warning "initialization from incompatible pointer type" } */
+ unsigned int *d = (U *) p; /* { dg-warning "initialization from incompatible pointer type" } */
+ (void) a;
+ (void) b;
+ (void) c;
+ (void) d;
+}