c-typeck.c (convert_for_assignment): Tightened up pointer converstions that differ...
authorMike Stump <mrs@apple.com>
Sat, 24 Jul 2004 07:32:15 +0000 (07:32 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Sat, 24 Jul 2004 07:32:15 +0000 (07:32 +0000)
        * c-typeck.c (convert_for_assignment): Tightened up pointer converstions
        that differ in signedness.
Apple Radar 2535328.

From-SVN: r85114

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/gcc.dg/conv-2.c [new file with mode: 0644]

index be41b26cf019d9a2debdce01b63dee99200d16a1..0c8219d00d08d3e437dd6c9e4439db3a4efc3b4a 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-23  Mike Stump  <mrs@apple.com>
+
+       * c-typeck.c (convert_for_assignment): Tightened up pointer converstions
+       that differ in signedness.
+
 2004-07-23  Zack Weinberg  <zack@codesourcery.com>
 
        * genmodes.c (make_vector_modes): Mark with ATTRIBUTE_UNUSED.
index 8d201cdbda5ceb7852de1ac49b94096f202df7dc..ba92b2e9fffad3821c22eff4edf44d7e95272dbf 100644 (file)
@@ -3472,7 +3472,7 @@ convert_for_assignment (tree type, tree rhs, const char *errtype,
                       || target_cmp)
                ;
              /* If there is a mismatch, do warn.  */
-             else if (pedantic)
+             else
                warn_for_assignment ("pointer targets in %s differ in signedness",
                                     errtype, funname, parmnum);
            }
diff --git a/gcc/testsuite/gcc.dg/conv-2.c b/gcc/testsuite/gcc.dg/conv-2.c
new file mode 100644 (file)
index 0000000..349c8ac
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void f1(long *);
+void f2(unsigned long *);
+
+int main()
+{
+  long *lp;
+  unsigned long *ulp;
+  char *cp;
+  unsigned char *ucp;
+  signed char *scp;
+
+  ulp = lp;    /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  lp = ulp;    /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  f1(ulp);     /* { dg-warning " differ in signedness" } */
+  f2(lp);      /* { dg-warning " differ in signedness" } */
+
+  cp = ucp;    /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  cp = scp;    /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  ucp = scp;   /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  ucp = cp;    /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  scp = ucp;   /* { dg-warning " pointer targets in assignment differ in signedness" } */
+  scp = cp;    /* { dg-warning " pointer targets in assignment differ in signedness" } */
+}