Commit 1c013b45 by Richard Kenner

(convert_to_integer): If TYPE is a enumeral type or if its precision is not the…

(convert_to_integer): If TYPE is a enumeral type or if its precision is not the same as the size of its mode...

(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.

From-SVN: r10140
parent b83b72a6
/* 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment