This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] remove the unsigned_type language hook


We have now:
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/assign-warn-1.c:64:
warning: passing argument 1 of 'cubFp.x' from incompatible pointer
type
/home/apinski/src/local/gcc/gcc/testsuite/gcc.dg/assign-warn-1.c:65:
warning: assignment from incompatible pointer type

While we are expecting:
64: warning: pointer targets in passing argument 1 of 'cubFp.x' differ
in signedness
65: warning: pointer targets in assignment differ in signedness

The code is doing an assignment from char* to unsigned char*.  And
char is unsigned by default on spu-elf.

From the description of the problem I would guess that the problem is
that we are returning char_type_node instead of
unsigned_char_type_node. Could you test the attached patch?

I am currently bootstraping it.

Cheers,
Rafael
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c	(revision 124790)
+++ gcc/c-common.c	(working copy)
@@ -2066,9 +2066,6 @@
 c_common_signed_or_unsigned_type (int unsignedp, tree type)
 {
   tree type1;
-  if (!INTEGRAL_TYPE_P (type)
-      || TYPE_UNSIGNED (type) == unsignedp)
-    return type;
 
   /* This block of code emulates the behavior of the old
      c_common_unsigned_type. In particular, it returns
@@ -2102,6 +2099,10 @@
   if (type1 == intQI_type_node || type1 == unsigned_intQI_type_node)
     return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
 
+  if (!INTEGRAL_TYPE_P (type)
+      || TYPE_UNSIGNED (type) == unsignedp)
+    return type;
+
   /* For ENUMERAL_TYPEs in C++, must check the mode of the types, not
      the precision; they have precision set to match their range, but
      may use a wider mode to match an ABI.  If we change modes, we may

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]