Skip to content

Extend argument of createIOThread to word size

Stefan Schulze Frielinghaus requested to merge (removed):master into master

In file rts/PrimOps.cmm function createIOThread is called two times:

("ptr" threadid) = ccall createIOThread( MyCapability() "ptr",
                                  RtsFlags_GcFlags_initialStkSize(RtsFlags),
                                  closure "ptr");

and

("ptr" threadid) = ccall createIOThread(
    MyCapability() "ptr",
    RtsFlags_GcFlags_initialStkSize(RtsFlags),
    closure "ptr");

Function createIOThread expects its second argument to be of size word:

StgTSO *
createIOThread (Capability *cap, W_ stack_size,  StgClosure *closure)

However, type of expression RtsFlags_GcFlags_initialStkSize(RtsFlags) is uint32_t. Passing a 32bit value via a register on some 64bit architectures requires the value to be zero extended since writing the lower half of a register does not necessarily zero the upper half. The cast to type W_ performs this.

Merge request reports