Patchwork Fix DW_OP_GNU_entry_value handling in .debug_loc duplicate removal

login
register
mail settings
Submitter Jakub Jelinek
Date March 25, 2011, 10:59 a.m.
Message ID <20110325105904.GX18914@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/88370/
State New
Headers show

Comments

Jakub Jelinek - March 25, 2011, 10:59 a.m.
Hi!

While working on a patch I'll post momentarily, I've noticed two
issues:
1) DW_OP_GNU_entry_value wasn't being handled by
   hash_loc_operands/compare_loc_operands, which means different entry
   values could be considered the same and a wrong location list
   could be used; the entry value patch was written way before that
   optimization has been added and I just forgot to adjust entry value
   patch when I've added that optimization
2) comparing GET_MODE_BITSIZE measured in bits with DWARF2_ADDR_SIZE
   measured in bytes is certainly wrong

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk?

2011-03-25  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (mem_loc_descriptor) <case ZERO_EXTRACT>: Compare
	mode size instead of bitsize with DWARF2_ADDR_SIZE.
	(hash_loc_operands, compare_loc_operands): Handle
	DW_OP_GNU_entry_value.


	Jakub
Richard Henderson - March 25, 2011, 4:12 p.m.
On 03/25/2011 03:59 AM, Jakub Jelinek wrote:
> 	* dwarf2out.c (mem_loc_descriptor) <case ZERO_EXTRACT>: Compare
> 	mode size instead of bitsize with DWARF2_ADDR_SIZE.
> 	(hash_loc_operands, compare_loc_operands): Handle
> 	DW_OP_GNU_entry_value.

Ok.


r~

Patch

--- gcc/dwarf2out.c.jj	2011-03-23 17:15:49.000000000 +0100
+++ gcc/dwarf2out.c	2011-03-24 11:16:07.000000000 +0100
@@ -14311,8 +14311,8 @@  mem_loc_descriptor (rtx rtl, enum machin
 	  && ((unsigned) INTVAL (XEXP (rtl, 1))
 	      + (unsigned) INTVAL (XEXP (rtl, 2))
 	      <= GET_MODE_BITSIZE (GET_MODE (rtl)))
-	  && GET_MODE_BITSIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE
-	  && GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE)
+	  && GET_MODE_SIZE (GET_MODE (rtl)) <= DWARF2_ADDR_SIZE
+	  && GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE)
 	{
 	  int shift, size;
 	  op0 = mem_loc_descriptor (XEXP (rtl, 0), mode,
@@ -23125,6 +23125,9 @@  hash_loc_operands (dw_loc_descr_ref loc,
     case DW_OP_GNU_implicit_pointer:
       hash = iterative_hash_object (val2->v.val_int, hash);
       break;
+    case DW_OP_GNU_entry_value:
+      hash = hash_loc_operands (val1->v.val_loc, hash);
+      break;
 
     default:
       /* Other codes have no operands.  */
@@ -23282,6 +23285,8 @@  compare_loc_operands (dw_loc_descr_ref x
 	     && valx1->val_class == valy1->val_class
 	     && valx1->v.val_die_ref.die == valy1->v.val_die_ref.die
 	     && valx2->v.val_int == valy2->v.val_int;
+    case DW_OP_GNU_entry_value:
+      return compare_loc_operands (valx1->v.val_loc, valy1->v.val_loc);
     default:
       /* Other codes have no operands.  */
       return true;