summaryrefslogtreecommitdiff
path: root/gcc/c-convert.c
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-07-17 04:26:02 +0000
committerRichard Stallman <rms@gnu.org>1992-07-17 04:26:02 +0000
commita0cf02b4bce7e97b68c2f19d8014a28e9a91b64b (patch)
treee1675dd77c2091e47acd777b3546e54f1a13d7b0 /gcc/c-convert.c
parent34c9156a022c85027904323569365a531d37158f (diff)
downloadgcc-a0cf02b4bce7e97b68c2f19d8014a28e9a91b64b.tar.gz
(convert_to_integer): Push truncation inside COND_EXPR.
From-SVN: r1609
Diffstat (limited to 'gcc/c-convert.c')
-rw-r--r--gcc/c-convert.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index a4b5a8bd3d5..564992af88f 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -335,6 +335,13 @@ convert_to_integer (type, expr)
convert (typex, arg1),
convert (typex, arg2))));
}
+ else
+ /* It is sometimes worthwhile
+ to push the narrowing down through the conditional. */
+ return fold (build (COND_EXPR, type,
+ TREE_OPERAND (expr, 0),
+ convert (type, TREE_OPERAND (expr, 1)),
+ convert (type, TREE_OPERAND (expr, 2))));
}
}
}