aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2013-08-08 18:42:21 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2013-08-08 18:42:21 +0000
commitf40423e28fa50514ff92f01846bd7ae89318b3bc (patch)
treeda52318ec63d85be2410eb5e67acd9e1c0c74225 /gcc/combine.c
parentd0595b65c9461d9f13f88b383f8dcef017c6c374 (diff)
downloadgcc-f40423e28fa50514ff92f01846bd7ae89318b3bc.zip
gcc-f40423e28fa50514ff92f01846bd7ae89318b3bc.tar.gz
gcc-f40423e28fa50514ff92f01846bd7ae89318b3bc.tar.bz2
re PR rtl-optimization/58079 (internal compiler error: in do_SUBST, at combine.c:711)
gcc/ PR rtl-optimization/58079 * combine.c (combine_simplify_rtx): Avoid using SUBST if simplify_comparison has widened a comparison with an integer. gcc/testsuite/ * gcc.dg/torture/pr58079.c: New test. From-SVN: r201609
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index d0aae69..29dfd15 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5803,8 +5803,15 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
return x;
}
- /* If the code changed, return a whole new comparison. */
- if (new_code != code)
+ /* If the code changed, return a whole new comparison.
+ We also need to avoid using SUBST in cases where
+ simplify_comparison has widened a comparison with a CONST_INT,
+ since in that case the wider CONST_INT may fail the sanity
+ checks in do_SUBST. */
+ if (new_code != code
+ || (CONST_INT_P (op1)
+ && GET_MODE (op0) != GET_MODE (XEXP (x, 0))
+ && GET_MODE (op0) != GET_MODE (XEXP (x, 1))))
return gen_rtx_fmt_ee (new_code, mode, op0, op1);
/* Otherwise, keep this operation, but maybe change its operands.