re PR rtl-optimization/17825 (ICE in reg_bitfield_target_p)
authorJakub Jelinek <jakub@redhat.com>
Sat, 27 Nov 2004 09:39:00 +0000 (10:39 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 27 Nov 2004 09:39:00 +0000 (10:39 +0100)
PR rtl-optimization/17825
* combine.c (subst): Ignore STRICT_LOW_PART no matter if REG_P (new)
or not.

* gcc.c-torture/compile/20041119-1.c: New test.

From-SVN: r91369

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20041119-1.c [new file with mode: 0644]

index 857aa8f10539fa9bef3c5ffdae3f2b886307c7c6..c1fe9b7dd0002ba579e32948c9b6600d3a9af9fe 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/17825
+       * combine.c (subst): Ignore STRICT_LOW_PART no matter if REG_P (new)
+       or not.
+
 2004-11-27  Alan Modra  <amodra@bigpond.net.au>
 
        PR target/12769
index ce198bbc10af1fbd6bf7f741988f380f16400572..181a33e7590a1030117a202ae273a03e245e55dd 100644 (file)
@@ -3556,10 +3556,10 @@ subst (rtx x, rtx from, rtx to, int in_dest, int unique_copy)
              /* If this is a register being set, ignore it.  */
              new = XEXP (x, i);
              if (in_dest
-                 && (code == SUBREG || code == STRICT_LOW_PART
-                     || code == ZERO_EXTRACT)
                  && i == 0
-                 && REG_P (new))
+                 && (((code == SUBREG || code == ZERO_EXTRACT)
+                      && REG_P (new))
+                     || code == STRICT_LOW_PART))
                ;
 
              else if (COMBINE_RTX_EQUAL_P (XEXP (x, i), from))
index 912c9b36e778c8bb2abf46f072032b2906f49946..dc3edeec50465c756d10b15047fd09bc7a048e54 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/17825
+       * gcc.c-torture/compile/20041119-1.c: New test.
+
 2004-11-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        * lib/target-libpath.exp (restore_ld_library_path_env_vars):
diff --git a/gcc/testsuite/gcc.c-torture/compile/20041119-1.c b/gcc/testsuite/gcc.c-torture/compile/20041119-1.c
new file mode 100644 (file)
index 0000000..3e0e565
--- /dev/null
@@ -0,0 +1,30 @@
+/* PR rtl-optimization/17825 */
+#ifdef __i386__
+register unsigned int reg __asm ("esi");
+#elif defined __x86_64__
+register unsigned int reg __asm ("r14");
+#else
+unsigned int reg;
+#endif
+
+struct S
+{
+  unsigned int h[8];
+} *b;
+unsigned int c;
+void foo (int);
+
+void
+bar (void)
+{
+  unsigned int j, k, l, m;
+
+  j = (reg & 0xffff) | ((b->h[2] & 0xffff) << 16);
+  k = c & 0xffff;
+  if (k == 0)
+    foo (0);
+  l = (j / k) & 0xffff;
+  m = (j % k) & 0xffff;
+  reg = (reg & 0xffff0000) | l;
+  b->h[2] = (b->h[2] & 0xffff0000) | m;
+}