Commit 4e9cd9d8 by DJ Delorie Committed by DJ Delorie

convert.c (convert_to_pointer): Avoid recursion if no conversion is needed.

* convert.c (convert_to_pointer): Avoid recursion if no conversion
is needed.

From-SVN: r100518
parent 1c1205fb
2005-06-02 DJ Delorie <dj@redhat.com>
* convert.c (convert_to_pointer): Avoid recursion if no conversion
is needed.
2005-06-02 Richard Guenther <rguenth@gcc.gnu.org>
* tree-chrec.c (chrec_fold_plus_1): Ensure we build
......
......@@ -42,10 +42,7 @@ tree
convert_to_pointer (tree type, tree expr)
{
if (integer_zerop (expr))
{
expr = build_int_cst (type, 0);
return expr;
}
return build_int_cst (type, 0);
switch (TREE_CODE (TREE_TYPE (expr)))
{
......@@ -57,13 +54,12 @@ convert_to_pointer (tree type, tree expr)
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case CHAR_TYPE:
if (TYPE_PRECISION (TREE_TYPE (expr)) == POINTER_SIZE)
return build1 (CONVERT_EXPR, type, expr);
if (TYPE_PRECISION (TREE_TYPE (expr)) != POINTER_SIZE)
expr = fold_build1 (NOP_EXPR,
lang_hooks.types.type_for_size (POINTER_SIZE, 0),
expr);
return fold_build1 (CONVERT_EXPR, type, expr);
return
convert_to_pointer (type,
convert (lang_hooks.types.type_for_size
(POINTER_SIZE, 0), expr));
default:
error ("cannot convert to a pointer type");
......
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