From: Roger Sayle Date: Sun, 21 Mar 2004 16:29:02 +0000 (+0000) Subject: re PR target/13889 (Assignment of an int to an int of different size in a struct... X-Git-Tag: releases/gcc-3.3.4~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ccde5b77de41a60bc141a322c182b4e0ef90542;p=thirdparty%2Fgcc.git 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 conversion operations. * gcc.c-torture/compile/pr13889.c: New test case. From-SVN: r79786 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 431df9b51cf2..8b4586661de4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-03-21 Roger Sayle + + PR target/13889 + * cse.c (fold_rtx): Avoid substituting constants into unary + conversion operations. + 2004-03-17 Ian Lance Taylor Backport: diff --git a/gcc/cse.c b/gcc/cse.c index e729cef2a55e..1ba700538d11 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -3854,6 +3854,23 @@ fold_rtx (x, 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) == '1' + && 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a4099ad613df..f19add88aa7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-03-21 Roger Sayle + + PR target/13889 + * gcc.c-torture/compile/pr13889.c: New test case. + 2004-03-13 Eric Botcazou PR middle-end/14470