aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2004-03-20 23:03:03 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2004-03-20 23:03:03 +0000
commit8cce3d04c451595cc9f33a332a4dbeae2729b40e (patch)
tree715204d51caed06f5a32eb4eba6087472e7e2e33 /gcc/cse.c
parent05fe5c6724457b820fb0750b3de07e90fba596f8 (diff)
downloadgcc-8cce3d04c451595cc9f33a332a4dbeae2729b40e.zip
gcc-8cce3d04c451595cc9f33a332a4dbeae2729b40e.tar.gz
gcc-8cce3d04c451595cc9f33a332a4dbeae2729b40e.tar.bz2
re PR target/13889 (Assignment of an int to an int of different size in a struct gives ICE)
PR target/13889 * cse.c (fold_rtx): Avoid substituting constants into unary convertion operations. * gcc.c-torture/compile/pr13889.c: New test case. From-SVN: r79762
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 9e4cab8..38f6ef0 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3662,6 +3662,23 @@ fold_rtx (rtx x, rtx insn)
|| (new_cost == old_cost && CONSTANT_P (XEXP (x, i))))
break;
+ /* It's not safe to substitute the operand of a conversion
+ operator with a constant, as the conversion's identity
+ depends upon the mode of it's operand. This optimization
+ is handled by the call to simplify_unary_operation. */
+ if (GET_RTX_CLASS (code) == RTX_UNARY
+ && GET_MODE (replacements[j]) != mode_arg0
+ && (code == ZERO_EXTEND
+ || code == SIGN_EXTEND
+ || code == TRUNCATE
+ || code == FLOAT_TRUNCATE
+ || code == FLOAT_EXTEND
+ || code == FLOAT
+ || code == FIX
+ || code == UNSIGNED_FLOAT
+ || code == UNSIGNED_FIX))
+ continue;
+
if (validate_change (insn, &XEXP (x, i), replacements[j], 0))
break;