From: Richard Kenner Date: Fri, 6 May 1994 16:59:23 +0000 (-0400) Subject: (comptypes): An enum type if compatible with type of same signedness X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8c21346e951e20db960b6ef4602f76677344c1b;p=gcc.git (comptypes): An enum type if compatible with type of same signedness as well as precision. From-SVN: r7227 --- diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index b1cb70b58d7..5b491979ba4 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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;