Commit 48b88421 authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by Ben Gamari

rts: fix format arguments for debugBelch calls on 32-bit systems

This change fixes build failure like this:
```
  rts/Stats.c:1467:14: error:
     error: format '%u' expects argument of type 'unsigned int',
         but argument 4 has type 'long unsigned int' [-Werror=format=]
       debugBelch("%51s%9" FMT_Word " %9" FMT_Word "\n",
                  ^~~~~~~~
                  "",tot_live*sizeof(W_),tot_slop*sizeof(W_));
                                         ~~~~~~~~~~~~~~~~~~~
```

The fix is to cast sizeof() result to Word (W_).
Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>

Test Plan: build for 32-bit target

Reviewers: bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D4608
parent 803178a5
......@@ -409,7 +409,7 @@ printClosure( const StgClosure *obj )
case COMPACT_NFDATA:
debugBelch("COMPACT_NFDATA(size=%" FMT_Word ")\n",
(W_)((StgCompactNFData *)obj)->totalW * sizeof(W_));
(W_)((StgCompactNFData *)obj)->totalW * (W_)sizeof(W_));
break;
......
......@@ -1465,7 +1465,7 @@ statDescribeGens(void)
}
debugBelch("----------------------------------------------------------------------\n");
debugBelch("%51s%9" FMT_Word " %9" FMT_Word "\n",
"",tot_live*sizeof(W_),tot_slop*sizeof(W_));
"",tot_live*(W_)sizeof(W_),tot_slop*(W_)sizeof(W_));
debugBelch("----------------------------------------------------------------------\n");
debugBelch("\n");
}
......
......@@ -859,7 +859,7 @@ void findSlop(bdescr *bd)
slop = (bd->blocks * BLOCK_SIZE_W) - (bd->free - bd->start);
if (slop > (1024/sizeof(W_))) {
debugBelch("block at %p (bdescr %p) has %" FMT_Word "KB slop\n",
bd->start, bd, slop / (1024/sizeof(W_)));
bd->start, bd, slop / (1024/(W_)sizeof(W_)));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment