This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] ia64: ensure unwind records' t coordinate gets set


>>> James E Wilson <wilson@specifixinc.com> 24.05.05 21:15:42 >>>
>On Mon, 2005-05-23 at 00:56, Jan Beulich wrote:
>> 	* config/tc-ia64.c (emit_one_bundle): Check all in-use slots
for
>> 	first with non-NULL unwind_record.
>
>This one took a little thought, as you didn't mention what exactly
was
>wrong.  The problem would be that if the next slot has no unwind
record,
>and some following slot does, then end_ptr is NULL, and we
accidentally
>initialize all unwind records, instead of those just belonging to the
>current instruction.  So we have to search for the next insn with
unwind
>info to set end_ptr.
>
>This code fragment occurs twice, and the second one is still wrong. 
>That one is harmless though, since we don't remove unwind records
from
>the list, and hence we just end up initializing them multiple times. 
>For consistency, we should either fix this one also, or else add a
>comment explaining why it is OK for it to be wrong.  The existing
>comment is actually wrong here, which adds to the possible confusion.

I didn't apply this, yet. Instead, I'd like to apply the following
revised patch. However, I didn't change the comment you said was wrong,
because I didn't understand what you think is wrong with it.

Jan

gas/
2005-05-25  Jan Beulich  <jbeulich@novell.com>

	* config/tc-ia64.c (emit_one_bundle): Restrict scope of ptr,
end_ptr,
	and last_ptr. Check all in-use slots for first one with
non-NULL
	unwind_record. Don't reload end_ptr before second update round.

---
/home/jbeulich/src/binutils/mainline/2005-05-18/gas/config/tc-ia64.c	2005-05-09
08:31:38.000000000 +0200
+++ 2005-05-18/gas/config/tc-ia64.c	2005-05-25 09:58:37.662626368
+0200
@@ -6479,7 +6479,6 @@ emit_one_bundle ()
   struct ia64_opcode *idesc;
   int end_of_insn_group = 0, user_template = -1;
   int n, i, j, first, curr, last_slot;
-  unw_rec_list *ptr, *last_ptr, *end_ptr;
   bfd_vma t0 = 0, t1 = 0;
   struct label_fix *lfix;
   struct insn_fix *ifix;
@@ -6534,7 +6533,9 @@ emit_one_bundle ()
   for (i = 0; i < 3 && md.num_slots_in_use > 0; ++i)
     {
       /* If we have unwind records, we may need to update some now. 
*/
-      ptr = md.slot[curr].unwind_record;
+      unw_rec_list *ptr = md.slot[curr].unwind_record;
+      unw_rec_list *end_ptr = NULL;
+
       if (ptr)
 	{
 	  /* Find the last prologue/body record in the list for the
current
@@ -6544,9 +6545,11 @@ emit_one_bundle ()
 	     issued.  This matters because there may have been nops
emitted
 	     meanwhile.  Any non-prologue non-body record followed by a
 	     prologue/body record must also refer to the current point. 
*/
-	  last_ptr = NULL;
-	  end_ptr = md.slot[(curr + 1) % NUM_SLOTS].unwind_record;
-	  for (; ptr != end_ptr; ptr = ptr->next)
+	  unw_rec_list *last_ptr;
+
+	  for (j = 1; end_ptr == NULL && j < md.num_slots_in_use; ++j)
+	    end_ptr = md.slot[(curr + j) % NUM_SLOTS].unwind_record;
+	  for (last_ptr = NULL; ptr != end_ptr; ptr = ptr->next)
 	    if (ptr->r.type == prologue || ptr->r.type == prologue_gr
 		|| ptr->r.type == body)
 	      last_ptr = ptr;
@@ -6814,7 +6817,6 @@ emit_one_bundle ()
 	  /* Set slot numbers for all remaining unwind records belonging
to the
 	     current insn.  There can not be any prologue/body unwind
records
 	     here.  */
-	  end_ptr = md.slot[(curr + 1) % NUM_SLOTS].unwind_record;
 	  for (; ptr != end_ptr; ptr = ptr->next)
 	    {
 	      ptr->slot_number = (unsigned long) f + i;

Attachment: binutils-mainline-ia64-unwind-assoc.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]