Skip to content

Commit

Permalink
hw/xive.c: Fix memcmp() in DEBUG build to compare struct not ptr
Browse files Browse the repository at this point in the history
With GCC9:

hw/xive.c: In function ‘xive_check_eq_update’:
hw/xive.c:3034:29: error: argument to ‘sizeof’ in ‘__builtin_memcmp’ call is the same expression as the first source; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
  if (memcmp(eq, &eq2, sizeof(eq)) != 0) {
                             ^
hw/xive.c: In function ‘xive_check_vpc_update’:
hw/xive.c:3056:29: error: argument to ‘sizeof’ in ‘__builtin_memcmp’ call is the same expression as the first source; did you mean to dereference it? [-Werror=sizeof-pointer-memaccess]
  if (memcmp(vp, &vp2, sizeof(vp)) != 0) {
                             ^
cc1: all warnings being treated as errors

Fixes: 2eea386
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
stewartsmith committed May 20, 2019
1 parent e0ed7e9 commit 59bdc3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/xive.c
Original file line number Diff line number Diff line change
Expand Up @@ -3027,7 +3027,7 @@ static bool xive_check_eq_update(struct xive *x, uint32_t idx, struct xive_eq *e

assert(eq_p);
eq2 = *eq_p;
if (memcmp(eq, &eq2, sizeof(eq)) != 0) {
if (memcmp(eq, &eq2, sizeof(struct xive_eq)) != 0) {
xive_err(x, "EQ update mismatch idx %d\n", idx);
xive_err(x, "want: %08x %08x %08x %08x\n",
eq->w0, eq->w1, eq->w2, eq->w3);
Expand All @@ -3049,7 +3049,7 @@ static bool xive_check_vpc_update(struct xive *x, uint32_t idx, struct xive_vp *

assert(vp_p);
vp2 = *vp_p;
if (memcmp(vp, &vp2, sizeof(vp)) != 0) {
if (memcmp(vp, &vp2, sizeof(struct xive_vp)) != 0) {
xive_err(x, "VP update mismatch idx %d\n", idx);
xive_err(x, "want: %08x %08x %08x %08x\n",
vp->w0, vp->w1, vp->w2, vp->w3);
Expand Down

0 comments on commit 59bdc3a

Please sign in to comment.