This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: implement typed DWARF stack
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: tromey at redhat dot com (Tom Tromey)
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 16 May 2011 17:50:05 +0200 (CEST)
- Subject: Re: RFC: implement typed DWARF stack
Tom Tromey wrote:
> >>>>> "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.
So just to clarify: in the discussion a while back, you said:
> Ulrich> B.t.w. your patch always performs an unsigned shift for
> Ulrich> DW_OP_shr, even on signed operands. However, for DW_OP_shra,
> Ulrich> your patch respects the sign of the operands and might actually
> Ulrich> perform an unsigned shift (even though the opcode explicitly
> Ulrich> says "arithmetic right shift" ...) This looks like another of
> Ulrich> those signed/unsigned inconsistencies with the proposal to me.
>
> Yes. My understanding is that for new-style typed values, DW_OP_shr and
> DW_OP_shra are actually the same -- the type indicates the operation to
> perform. But, for old-style values, we must cast to unsigned for
> DW_OP_shr.
With this latest patch, it is now definitely *not* the case that DW_OP_shr
and DW_OP_shra behave the same on new-style typed values. Instead, as I
pointed out originally, DW_OP_shr now always performs an unsigned operation,
while DW_OP_shra respects the value's type ...
Is that really what was intended? Or should rather DW_OP_shra now also
be changed (to always perform a signed operation as its name suggests)?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com