svn commit: r315477 - head/sys/ddb
Bruce Evans
bde at FreeBSD.org
Sat Mar 18 07:01:20 UTC 2017
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();
}
More information about the svn-src-all
mailing list