aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-05-06 12:59:23 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-05-06 12:59:23 -0400
commitb8c21346e951e20db960b6ef4602f76677344c1b (patch)
treef5b99b6db23290cc3e409911212c94a49302c364
parentc9325fd6c62f615e1be9a4d009f23cb770d90c68 (diff)
downloadgcc-b8c21346e951e20db960b6ef4602f76677344c1b.zip
gcc-b8c21346e951e20db960b6ef4602f76677344c1b.tar.gz
gcc-b8c21346e951e20db960b6ef4602f76677344c1b.tar.bz2
(comptypes): An enum type if compatible with type of same signedness
as well as precision. From-SVN: r7227
-rw-r--r--gcc/c-typeck.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index b1cb70b..5b49197 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;