re PR debug/46867 (ICE: in emit_note_insn_var_location, at var-tracking.c:7325 with...
authorJakub Jelinek <jakub@redhat.com>
Mon, 13 Dec 2010 17:36:26 +0000 (18:36 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 13 Dec 2010 17:36:26 +0000 (18:36 +0100)
PR debug/46867
* var-tracking.c (emitted_notes, string_pointer_flags): Removed.
(emit_note_insn_var_location): Remove ENABLE_RTL_CHECKING verification.
(vt_emit_notes): Don't initialize and destroy emitted_notes.

* gcc.dg/pr46867.c: New test.

From-SVN: r167754

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr46867.c [new file with mode: 0644]
gcc/var-tracking.c

index ced6603f665a0fb4906d84f376afe21bd239a0fc..9a539a9420f602aa529c71bd11df169a70dd40b5 100644 (file)
@@ -1,3 +1,10 @@
+2010-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/46867
+       * var-tracking.c (emitted_notes, string_pointer_flags): Removed.
+       (emit_note_insn_var_location): Remove ENABLE_RTL_CHECKING verification.
+       (vt_emit_notes): Don't initialize and destroy emitted_notes.
+
 2010-12-13  Jan Hubicka  <jh@suse.cz>
 
        PR middle-end/45388
index d52333f46031818d198f0daab56e31d65184e664..05882fac31907c4c2bab790f4535a043123e61d8 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/46867
+       * gcc.dg/pr46867.c: New test.
+
 2010-12-13  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/46841
diff --git a/gcc/testsuite/gcc.dg/pr46867.c b/gcc/testsuite/gcc.dg/pr46867.c
new file mode 100644 (file)
index 0000000..9225bce
--- /dev/null
@@ -0,0 +1,32 @@
+/* PR debug/46867 */
+/* { dg-do compile } */
+/* { dg-options "-O -g" } */
+
+typedef __PTRDIFF_TYPE__ ptrdiff_t;
+
+extern void *bar (void);
+
+void
+foo (int x, char *r1, char *r2, __INTPTR_TYPE__ *rp, char *t)
+{
+  char *tx = tx;
+  char **cc = bar ();
+  ptrdiff_t rx = r1 - r2;
+  for (;;)
+    {
+      char *cp1 = (char *) *rp;
+      char *cp2 = t;
+      char *s;
+      ptrdiff_t len = cp1 - tx + rx * (cp2 - cp1);
+      while (len)
+       ;
+      for (s = tx; s; s++)
+       ;
+      while (s)
+       if (s == cc[s - r1])
+         if (x)
+           bar ();
+      if (cp1)
+       tx = cp2;
+    }
+}
index 35ca1cb35fc05c78fe1fdd034f6e92a9794d12b1..44701be12e8a27d41c20fa5def6203e7fb5f0e43 100644 (file)
@@ -7095,24 +7095,6 @@ vt_expand_loc_dummy (rtx loc, htab_t vars, bool *pcur_loc_changed)
   return ret;
 }
 
-#ifdef ENABLE_RTL_CHECKING
-/* Used to verify that cur_loc_changed updating is safe.  */
-static struct pointer_map_t *emitted_notes;
-
-/* Strip REG_POINTER from REGs and MEM_POINTER from MEMs in order to
-   avoid differences in commutative operand simplification.  */
-static rtx
-strip_pointer_flags (rtx x, const_rtx old_rtx ATTRIBUTE_UNUSED,
-                    void *data ATTRIBUTE_UNUSED)
-{
-  if (REG_P (x) && REG_POINTER (x))
-    return gen_rtx_REG (GET_MODE (x), REGNO (x));
-  if (MEM_P (x) && MEM_POINTER (x))
-    return gen_rtx_MEM (GET_MODE (x), XEXP (x, 0));
-  return NULL_RTX;
-}
-#endif
-
 /* Emit the NOTE_INSN_VAR_LOCATION for variable *VARP.  DATA contains
    additional parameters: WHERE specifies whether the note shall be emitted
    before or after instruction INSN.  */
@@ -7157,10 +7139,8 @@ emit_note_insn_var_location (void **varp, void *data)
       if (var->n_var_parts == 0)
        var->cur_loc_changed = true;
     }
-#ifndef ENABLE_RTL_CHECKING
   if (!var->cur_loc_changed)
     goto clear;
-#endif
   for (i = 0; i < var->n_var_parts; i++)
     {
       enum machine_mode mode, wider_mode;
@@ -7302,36 +7282,6 @@ emit_note_insn_var_location (void **varp, void *data)
                                      parallel, (int) initialized);
     }
 
-#ifdef ENABLE_RTL_CHECKING
-  if (note_vl)
-    {
-      void **note_slot = pointer_map_insert (emitted_notes, decl);
-      rtx pnote = (rtx) *note_slot;
-      if (!var->cur_loc_changed && (pnote || PAT_VAR_LOCATION_LOC (note_vl)))
-       {
-         rtx old_vl, new_vl;
-         gcc_assert (pnote);
-         old_vl = PAT_VAR_LOCATION_LOC (pnote);
-         new_vl = PAT_VAR_LOCATION_LOC (note_vl);
-         if (!rtx_equal_p (old_vl, new_vl))
-           {
-             /* There might be differences caused by REG_POINTER
-                differences.  REG_POINTER affects
-                swap_commutative_operands_p.  */
-             old_vl = simplify_replace_fn_rtx (old_vl, NULL_RTX,
-                                               strip_pointer_flags, NULL);
-             new_vl = simplify_replace_fn_rtx (new_vl, NULL_RTX,
-                                               strip_pointer_flags, NULL);
-             gcc_assert (rtx_equal_p (old_vl, new_vl));
-             PAT_VAR_LOCATION_LOC (note_vl) = new_vl;
-           }
-       }
-      *note_slot = (void *) note_vl;
-    }
-  if (!var->cur_loc_changed)
-    goto clear;
-#endif
-
   if (where != EMIT_NOTE_BEFORE_INSN)
     {
       note = emit_note_after (NOTE_INSN_VAR_LOCATION, insn);
@@ -7960,9 +7910,6 @@ vt_emit_notes (void)
   basic_block bb;
   dataflow_set cur;
 
-#ifdef ENABLE_RTL_CHECKING
-  emitted_notes = pointer_map_create ();
-#endif
   gcc_assert (!htab_elements (changed_variables));
 
   /* Free memory occupied by the out hash tables, as they aren't used
@@ -8022,9 +7969,6 @@ vt_emit_notes (void)
       VEC_free (rtx, heap, changed_values_stack);
     }
 
-#ifdef ENABLE_RTL_CHECKING
-  pointer_map_destroy (emitted_notes);
-#endif
   emit_notes = false;
 }