This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: RFC: implement typed DWARF stack


>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:

Tom> Yes.  My understanding is that for new-style typed values, DW_OP_shr and
Tom> DW_OP_shra are actually the same -- the type indicates the operation to
Tom> perform.  But, for old-style values, we must cast to unsigned for
Tom> DW_OP_shr.

Ulrich> I see.  However, the code as implemented casts *all* signed values to
Ulrich> unsigned for DW_OP_shr, not just old-style values.  That's what got
Ulrich> me confused ...

I mentioned this on the GCC list and Jakub said that GCC actually emits
code assuming that the operation will always be unsigned.

So, I am reverting my change here.  Patch appended.

Tom

2011-05-12  Tom Tromey  <tromey@redhat.com>

	* dwarf2expr.c (execute_stack_op) <DW_OP_shr>: Unconditionally
	cast left-hand-side to unsigned.

Index: dwarf2expr.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2expr.c,v
retrieving revision 1.58
diff -u -r1.58 dwarf2expr.c
--- dwarf2expr.c	12 May 2011 17:40:54 -0000	1.58
+++ dwarf2expr.c	12 May 2011 19:28:28 -0000
@@ -979,7 +979,7 @@
 	      case DW_OP_shr:
 		dwarf_require_integral (value_type (first));
 		dwarf_require_integral (value_type (second));
-		if (value_type (first) == address_type)
+		if (!TYPE_UNSIGNED (value_type (first)))
 		  {
 		    struct type *utype
 		      = get_unsigned_type (ctx->gdbarch, value_type (first));


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