summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-20 10:40:26 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-20 10:40:26 +0000
commitec657618b850f3fa2e7fc8658cdf44fc13fceeb1 (patch)
tree757fae8ae740aefebb4bf8125e86751acc14775f
parenteaec62273b8dd9997cb085cde305dd39f3cd2211 (diff)
downloadppe42-gcc-ec657618b850f3fa2e7fc8658cdf44fc13fceeb1.tar.gz
ppe42-gcc-ec657618b850f3fa2e7fc8658cdf44fc13fceeb1.zip
PR c/39464
* c-typeck.c (convert_for_assignment): For -Wpointer-sign warning require that both c_common_unsigned_type as well as c_common_signed_type is the same for both mvl and mvr types. * gcc.dg/pr39464.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194630 138bc75d-0d04-0410-961f-82ee72b054a4
-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 00000000000..cd745406da8
--- /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;
+}
OpenPOWER on IntegriCloud