Greetings,

Roman reports that Clang warns on unnecessary calls to labs():

  taking the absolute value of unsigned type 'unw_word_t' (aka
'unsigned long') has no effect [-Werror,-Wabsolute-value]

Since rs->reg[...].val is unw_word_t and unsigned on all platforms,
this patch removes the unnecessary calls to labs().

Tested on Linux x86_64, no regressions.

Thanks,
-- 
Paul Pluzhnikov
diff --git a/src/x86_64/Gstash_frame.c b/src/x86_64/Gstash_frame.c
index 962b103..b9a53a3 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)
-      && labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29)
+      && 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
-             && labs(rs->reg[RBP].val) < (1 << 14)
+             && 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
-             && labs(rs->reg[RSP].val) < (1 << 14)
+             && 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

Reply via email to