]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/55150 (Crash in copy_rtx)
authorVladimir Makarov <vmakarov@redhat.com>
Thu, 1 Nov 2012 19:02:40 +0000 (19:02 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Thu, 1 Nov 2012 19:02:40 +0000 (19:02 +0000)
2012-11-01  Vladimir Makarov  <vmakarov@redhat.com>

PR middle-end/55150
* lra-constraints.c (lra_constraints): Check only pseudos with
equivalences.  Add insns with equivalence pseudos.

2012-11-01  Vladimir Makarov  <vmakarov@redhat.com>

PR middle-end/55150
* gcc.dg/pr55150.c: Rename to gcc.dg/pr55150-1.c.
* gcc.dg/pr55150-2.c: New test.

From-SVN: r193065

gcc/ChangeLog
gcc/lra-constraints.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr55150-1.c [moved from gcc/testsuite/gcc.dg/pr55150.c with 100% similarity]
gcc/testsuite/gcc.dg/pr55150-2.c [new file with mode: 0644]

index 156d3720af68f3086ec76fde27606dec807c3d86..6782cad7832be45ced47ce9ccd8edec98ff99c31 100644 (file)
@@ -1,3 +1,9 @@
+2012-11-01  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR middle-end/55150
+       * lra-constraints.c (lra_constraints): Check only pseudos with
+       equivalences.  Add insns with equivalence pseudos.
+
 2012-11-01  Sharad Singhai  <singhai@google.com>
 
        PR other/55164
index cd0325b8bf4c98cb08f738073809636b09248b51..afc49d75bdf9f9192dcac081d92c036111e33223 100644 (file)
@@ -3244,9 +3244,11 @@ lra_constraints (bool first_p)
 {
   bool changed_p;
   int i, hard_regno, new_insns_num;
-  unsigned int min_len, new_min_len;
-  rtx set, x, dest_reg;
+  unsigned int min_len, new_min_len, uid;
+  rtx set, x, reg, dest_reg;
   basic_block last_bb;
+  bitmap_head equiv_insn_bitmap;
+  bitmap_iterator bi;
 
   lra_constraint_iter++;
   if (lra_dump_file != NULL)
@@ -3261,10 +3263,12 @@ lra_constraints (bool first_p)
   lra_risky_transformations_p = false;
   new_insn_uid_start = get_max_uid ();
   new_regno_start = first_p ? lra_constraint_new_regno_start : max_reg_num ();
+  bitmap_initialize (&equiv_insn_bitmap, &reg_obstack);
   for (i = FIRST_PSEUDO_REGISTER; i < new_regno_start; i++)
     if (lra_reg_info[i].nrefs != 0)
       {
        ira_reg_equiv[i].profitable_p = true;
+       reg = regno_reg_rtx[i];
        if ((hard_regno = lra_get_regno_hard_regno (i)) >= 0)
          {
            int j, nregs = hard_regno_nregs[hard_regno][PSEUDO_REGNO_MODE (i)];
@@ -3272,7 +3276,7 @@ lra_constraints (bool first_p)
            for (j = 0; j < nregs; j++)
              df_set_regs_ever_live (hard_regno + j, true);
          }
-       else if ((x = get_equiv_substitution (regno_reg_rtx[i])) != NULL_RTX)
+       else if ((x = get_equiv_substitution (reg)) != reg)
          {
            bool pseudo_p = contains_reg_p (x, false, false);
            rtx set, insn;
@@ -3310,8 +3314,15 @@ lra_constraints (bool first_p)
              ira_reg_equiv[i].defined_p = false;
            if (contains_reg_p (x, false, true))
              ira_reg_equiv[i].profitable_p = false;
+           if (get_equiv_substitution (reg) != reg)
+             bitmap_ior_into (&equiv_insn_bitmap, &lra_reg_info[i].insn_bitmap);
          }
       }
+  /* We should add all insns containing pseudos which should be
+     substituted by their equivalences.  */
+  EXECUTE_IF_SET_IN_BITMAP (&equiv_insn_bitmap, 0, uid, bi)
+    lra_push_insn_by_uid (uid);
+  bitmap_clear (&equiv_insn_bitmap);
   lra_eliminate (false);
   min_len = lra_insn_stack_length ();
   new_insns_num = 0;
index 04a768c6ebf0f003ff7d5eb9c5a8daa1da8de8e9..2f63b8e01a4cc76ba9e4e28b41a9db0d4ecbc7fc 100644 (file)
@@ -1,3 +1,9 @@
+2012-11-01  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR middle-end/55150
+       * gcc.dg/pr55150.c: Rename to gcc.dg/pr55150-1.c.
+       * gcc.dg/pr55150-2.c: New test.
+
 2012-11-01  Sharad Singhai  <singhai@google.com>
 
        * testsuite/gcc.dg/plugin/selfassign.c: Add opgtroup_flags initializer.
diff --git a/gcc/testsuite/gcc.dg/pr55150-2.c b/gcc/testsuite/gcc.dg/pr55150-2.c
new file mode 100644 (file)
index 0000000..48dbb53
--- /dev/null
@@ -0,0 +1,53 @@
+/* PR middle-end/55150 */
+/* { dg-do compile } */
+/* { dg-options "-Os -g -fPIC" } */
+
+typedef unsigned char DES_cblock[8];
+ typedef struct DES_ks {
+ }
+ DES_key_schedule;
+ void DES_ede3_cbcm_encrypt (const unsigned char *in, unsigned char *out,                     long length, DES_key_schedule * ks1,                    DES_key_schedule * ks2, DES_key_schedule * ks3,                 DES_cblock * ivec1, DES_cblock * ivec2, int enc) {
+   register unsigned long tout0, tout1, xor0, xor1, m0, m1;
+   register long l = length;
+   unsigned long tin[2];
+   unsigned char *iv1, *iv2;
+   iv1 = &(*ivec1)[0];
+   iv2 = &(*ivec2)[0];
+   if (enc)     {
+       (m0 = ((unsigned long) (*((iv1)++))), m0 |=        ((unsigned long) (*((iv1)++))) << 8L, m0 |=        ((unsigned long) (*((iv1)++))) << 16L, m0 |=        ((unsigned long) (*((iv1)++))) << 24L);
+       (m1 = ((unsigned long) (*((iv1)++))), m1 |=        ((unsigned long) (*((iv1)++))) << 8L, m1 |=        ((unsigned long) (*((iv1)++))) << 16L, m1 |=        ((unsigned long) (*((iv1)++))) << 24L);
+       (tout0 = ((unsigned long) (*((iv2)++))), tout0 |=        ((unsigned long) (*((iv2)++))) << 8L, tout0 |=        ((unsigned long) (*((iv2)++))) << 16L, tout0 |=        ((unsigned long) (*((iv2)++))) << 24L);
+       for (l -= 8;
+ l >= -7;
+ l -= 8)       {
+         DES_encrypt1 (tin, ks3, 1);
+         DES_encrypt1 (tin, ks1, 1);
+       }
+       (*((iv1)++) = (unsigned char) (((m0)) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 8L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 16L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 24L) & 0xff));
+       (*((iv1)++) = (unsigned char) (((m1)) & 0xff), *((iv1)++) =        (unsigned char) (((m1) >> 8L) & 0xff), *((iv1)++) =        (unsigned char) (((m1) >> 16L) & 0xff), *((iv1)++) =        (unsigned char) (((m1) >> 24L) & 0xff));
+       (*((iv2)++) = (unsigned char) (((tout0)) & 0xff), *((iv2)++) =        (unsigned char) (((tout0) >> 8L) & 0xff), *((iv2)++) =        (unsigned char) (((tout0) >> 16L) & 0xff), *((iv2)++) =        (unsigned char) (((tout0) >> 24L) & 0xff));
+     }
+   else     {
+       (m0 = ((unsigned long) (*((iv1)++))), m0 |=        ((unsigned long) (*((iv1)++))) << 8L, m0 |=        ((unsigned long) (*((iv1)++))) << 16L, m0 |=        ((unsigned long) (*((iv1)++))) << 24L);
+       (xor1 = ((unsigned long) (*((iv2)++))), xor1 |=        ((unsigned long) (*((iv2)++))) << 8L, xor1 |=        ((unsigned long) (*((iv2)++))) << 16L, xor1 |=        ((unsigned long) (*((iv2)++))) << 24L);
+       for (l -= 8;
+ l >= -7;
+ l -= 8)       {
+         DES_encrypt1 (tin, ks3, 1);
+         if (l < 0)        {
+             {
+               switch (l + 8)            {
+                 case 7:                   *(--(out)) = (unsigned char) (((tout1) >> 16L) & 0xff);
+                 case 6:                   *(--(out)) = (unsigned char) (((tout1) >> 8L) & 0xff);
+                 case 5:                   *(--(out)) = (unsigned char) (((tout1)) & 0xff);
+                 case 4:                   *(--(out)) = (unsigned char) (((tout0) >> 24L) & 0xff);
+                 case 1:                   *(--(out)) = (unsigned char) (((tout0)) & 0xff);
+                 }
+             };
+           }
+       }
+       (*((iv1)++) = (unsigned char) (((m0)) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 8L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 16L) & 0xff), *((iv1)++) =        (unsigned char) (((m0) >> 24L) & 0xff));
+       (*((iv2)++) = (unsigned char) (((xor0)) & 0xff), *((iv2)++) =        (unsigned char) (((xor0) >> 8L) & 0xff), *((iv2)++) =        (unsigned char) (((xor0) >> 16L) & 0xff), *((iv2)++) =        (unsigned char) (((xor0) >> 24L) & 0xff));
+       (*((iv2)++) = (unsigned char) (((xor1)) & 0xff), *((iv2)++) =        (unsigned char) (((xor1) >> 8L) & 0xff), *((iv2)++) =        (unsigned char) (((xor1) >> 16L) & 0xff), *((iv2)++) =        (unsigned char) (((xor1) >> 24L) & 0xff));
+     }
+ }