OSDN Git Service

(comptypes): An enum type if compatible with type of same signedness
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 May 1994 16:59:23 +0000 (16:59 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 6 May 1994 16:59:23 +0000 (16:59 +0000)
as well as precision.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@7227 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index b1cb70b..5b49197 100644 (file)
@@ -398,12 +398,13 @@ comptypes (type1, type2)
   if (t1 == t2 || TREE_CODE (t1) == ERROR_MARK || TREE_CODE (t2) == ERROR_MARK)
     return 1;
 
-  /* Treat an enum type as the unsigned integer type of the same width.  */
+  /* Treat an enum type as the integer type of the same width and 
+     signedness.  */
 
   if (TREE_CODE (t1) == ENUMERAL_TYPE)
-    t1 = type_for_size (TYPE_PRECISION (t1), 1);
+    t1 = type_for_size (TYPE_PRECISION (t1), TREE_UNSIGNED (t1));
   if (TREE_CODE (t2) == ENUMERAL_TYPE)
-    t2 = type_for_size (TYPE_PRECISION (t2), 1);
+    t2 = type_for_size (TYPE_PRECISION (t2), TREE_UNSIGNED (t2));
 
   if (t1 == t2)
     return 1;