On Tue, Aug 12, 2014 at 10:58 PM, Arun Sharma <[email protected]> wrote:
>
> Looks good. Should show up in git in a couple of days.
We've just traced a large memory increase to that patch (Google ref:
b/18069427).
It appears that labs() was there for a good reason.
Sorry about that :-(
For the curious:
unsigned long u1 = ~0UL;
unsigned long u2 = labs(u1);
assert(u1 != u2); // labs on unsigned *may* have an effect, despite
what Clang says.
Attached patch suppresses the Clang warning, while still keeping the
original behavior (which I believe to be correct).
Thanks,
--
Paul Pluzhnikov
diff --git a/src/x86_64/Gstash_frame.c b/src/x86_64/Gstash_frame.c
index 33a44ec..dc6c7c8 100644
--- a/src/x86_64/Gstash_frame.c
+++ b/src/x86_64/Gstash_frame.c
@@ -50,17 +50,17 @@ tdep_stash_frame (struct dwarf_cursor *d, struct
dwarf_reg_state *rs)
&& (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG)
&& (rs->reg[DWARF_CFA_REG_COLUMN].val == RBP
|| rs->reg[DWARF_CFA_REG_COLUMN].val == RSP)
- && rs->reg[DWARF_CFA_OFF_COLUMN].val < (1 << 29)
+ && labs((long) rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29)
&& DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8
&& (rs->reg[RBP].where == DWARF_WHERE_UNDEF
|| rs->reg[RBP].where == DWARF_WHERE_SAME
|| (rs->reg[RBP].where == DWARF_WHERE_CFAREL
- && rs->reg[RBP].val < (1 << 14)
+ && labs((long) rs->reg[RBP].val) < (1 << 14)
&& rs->reg[RBP].val+1 != 0))
&& (rs->reg[RSP].where == DWARF_WHERE_UNDEF
|| rs->reg[RSP].where == DWARF_WHERE_SAME
|| (rs->reg[RSP].where == DWARF_WHERE_CFAREL
- && rs->reg[RSP].val < (1 << 14)
+ && labs((long) rs->reg[RSP].val) < (1 << 14)
&& rs->reg[RSP].val+1 != 0)))
{
/* Save information for a standard frame. */
_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel