diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-02-16 00:41:58 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-02-16 00:41:58 +0000 |
commit | cda09c61d7286801a6532a17fcf8e9ebab5665ae (patch) | |
tree | 91e9b8d9748714d68afb7086061668a5b0af8fe7 /gcc/c-common.c | |
parent | e0d8778bdd24b77a4af9af806091234cc21e0ec0 (diff) | |
download | gcc-cda09c61d7286801a6532a17fcf8e9ebab5665ae.tar.gz |
* c-common.c (shorten_compare): Get the min/max value from the
underlying type of an enumeration, not the enumerated type itself.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25228 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 5975236a393..aa94b087989 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -2406,6 +2406,12 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr) type = signed_or_unsigned_type (unsignedp0, TREE_TYPE (primop0)); + /* If TYPE is an enumeration, then we need to get its min/max + values from it's underlying integral type, not the enumerated + type itself. */ + if (TREE_CODE (type) == ENUMERAL_TYPE) + type = type_for_size (TYPE_PRECISION (type), unsignedp0); + maxval = TYPE_MAX_VALUE (type); minval = TYPE_MIN_VALUE (type); |