]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/13889 (Assignment of an int to an int of different size in a struct...
authorRoger Sayle <roger@eyesopen.com>
Sun, 21 Mar 2004 16:29:02 +0000 (16:29 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 21 Mar 2004 16:29:02 +0000 (16:29 +0000)
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

gcc/ChangeLog
gcc/cse.c
gcc/testsuite/ChangeLog

index 431df9b51cf283b3917e900dbf07b094f0d2f399..8b4586661de4bcb71689213326e64ce8d6797e74 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-21  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/13889
+       * cse.c (fold_rtx): Avoid substituting constants into unary
+       conversion operations.
+
 2004-03-17  Ian Lance Taylor  <ian@wasabisystems.com>
 
        Backport:
index e729cef2a55e3dce561b4cd72030bd732591bb19..1ba700538d11e1e12d90f3574c7cd7ea5a5bd046 100644 (file)
--- 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;
 
index a4099ad613df2fcd0891396f59a57dfe17f7f290..f19add88aa7d58e5653fd7362f2baa3e0cc1a786 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-21  Roger Sayle  <roger@eyesopen.com>
+
+       PR target/13889
+       * gcc.c-torture/compile/pr13889.c: New test case.
+
 2004-03-13  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR middle-end/14470