summaryrefslogtreecommitdiff
path: root/gcc/convert.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-12 21:35:19 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-10-12 21:35:19 +0000
commita3ed3761ca3501faa64e92e7e38d32fdb146a0ff (patch)
treeba5ea342196989db654db06103cbefccccbe76fc /gcc/convert.c
parent64c0b1493f1490fe1a0171227b57429410dc15f2 (diff)
downloadgcc-a3ed3761ca3501faa64e92e7e38d32fdb146a0ff.tar.gz
2011-10-12 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 179863 using svnmerge. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@179867 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/convert.c')
-rw-r--r--gcc/convert.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/convert.c b/gcc/convert.c
index a647193ca94..f04b2048194 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -745,6 +745,15 @@ convert_to_integer (tree type, tree expr)
tree arg0 = get_unwidened (TREE_OPERAND (expr, 0), type);
tree arg1 = get_unwidened (TREE_OPERAND (expr, 1), type);
+ /* Do not try to narrow operands of pointer subtraction;
+ that will interfere with other folding. */
+ if (ex_form == MINUS_EXPR
+ && CONVERT_EXPR_P (arg0)
+ && CONVERT_EXPR_P (arg1)
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg0, 0)))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0))))
+ break;
+
if (outprec >= BITS_PER_WORD
|| TRULY_NOOP_TRUNCATION (outprec, inprec)
|| inprec > TYPE_PRECISION (TREE_TYPE (arg0))