Author: bde
Date: Sat Mar 18 07:01:18 2017
New Revision: 315477
URL: https://svnweb.freebsd.org/changeset/base/315477

Log:
  Fix right shifts on arches with db_expr_t larger than u_int (LP64 arches
  in practice).
  
  db_expr_t is a signed type, but right shifts are fudged to evaluate
  them in an unsigned type, and the unsigned type was broken by hard-
  coding it as 'unsigned', so casting to it lost the top bits on arches
  with db_expr_t larger than u_int.
  
  The unsigned type with the same size as db_expr_t is not declared;
  assume that db_addr_t gives it.  Fixing this properly is less important
  than using the correct type for db_expr_t (originally always long for
  C90, but always intmax_t since C99).

Modified:
  head/sys/ddb/db_expr.c

Modified: head/sys/ddb/db_expr.c
==============================================================================
--- head/sys/ddb/db_expr.c      Sat Mar 18 06:05:54 2017        (r315476)
+++ head/sys/ddb/db_expr.c      Sat Mar 18 07:01:18 2017        (r315477)
@@ -261,7 +261,7 @@ db_shift_expr(db_expr_t *valuep)
                lhs <<= rhs;
            else {
                /* Shift right is unsigned */
-               lhs = (unsigned) lhs >> rhs;
+               lhs = (db_addr_t)lhs >> rhs;
            }
            t = db_read_token();
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to