I believe the guarantee at that chunk of code is that void_total of the era will be >= 0.

I could add an asset at those sections of code if need be.

If not, what is the correct type to be used here? I think size_t is reasonable as none of them are supposed to be negative in the first place.


On Sat 11 Feb, 2017, 3:51 PM GHC, <ghc-devs@haskell.org> wrote:
#12636: ProfHeap's printf modifiers are incorrect
-------------------------------------+-------------------------------------
        Reporter:  Phyx-             |                Owner:  bollu
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Runtime System    |              Version:  8.0.1
      Resolution:                    |             Keywords:  newcomer
Operating System:  Windows           |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Phyx-):

 I actually question the use of `ssize_t` at all for these values. I think
 the calculations violate the expected value ranges of `ssize_t` namely
 with

 {{{
 censuses[t].void_total   += size;
 censuses[era].void_total -= size;
 }}}

 So I think the types in `_counter` are wrong and have the potential to do
 an unsigned underflow as `ssize_t` is only guaranteed to be able to store
 values between `[-1, {SSIZE_MAX}]`[1]

 [1]http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12636#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
--
Sending this from my phone, please excuse any typos!