diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-07-17 16:54:50 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1995-07-17 16:54:50 +0000 |
commit | 4f202b4186fb945650437056bd98a7ce82230a22 (patch) | |
tree | a8cd1f18cfbdc7fa335dc96d2fbd361c959f438a /gcc/convert.c | |
parent | c3436a3c791438750c9dfa47aa757ed70eb7899c (diff) | |
download | gcc-4f202b4186fb945650437056bd98a7ce82230a22.tar.gz |
(convert_to_integer): If TYPE is a enumeral type or if its precision
is not the same as the size of its mode, convert in two steps.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10140 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r-- | gcc/convert.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/convert.c b/gcc/convert.c index e7b5df01e78..17e755243af 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -1,5 +1,5 @@ /* Utility routines for data type conversion for GNU C. - Copyright (C) 1987, 1988, 1991, 1992, 1994 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 91, 92, 94, 1995 Free Software Foundation, Inc. This file is part of GNU C. @@ -171,6 +171,17 @@ convert_to_integer (type, expr) else if (outprec >= inprec) return build1 (NOP_EXPR, type, expr); + /* If TYPE is an enumeral type or a type with a precision less + than the number of bits in its mode, do the conversion to the + type corresponding to its mode, then do a nop conversion + to TYPE. */ + else if (TREE_CODE (type) == ENUMERAL_TYPE + || outprec != GET_MODE_BITSIZE (TYPE_MODE (type))) + return build1 (NOP_EXPR, type, + convert (type_for_mode (TYPE_MODE (type), + TREE_UNSIGNED (type)), + expr)); + /* Here detect when we can distribute the truncation down past some arithmetic. For example, if adding two longs and converting to an int, we can equally well convert both to ints and then add. |