Date: Sat, 18 Mar 2017 07:01:19 +0000 (UTC) From: Bruce Evans <bde@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315477 - head/sys/ddb Message-ID: <201703180701.v2I71Jgc086312@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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(); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703180701.v2I71Jgc086312>