Skip to content

Compact regions with sharing can lose pointer tags.

This caused #21189 (closed)

This issue is as follows. We create a compact region with some values.

We add a constructor with strict fields, where the fields reference values already in the compact region.

This (eventually) results in a call to stg_compactAddWorkerzh in order to compact the closures the constructor fields point to, with this particular snippet being executed.

    // Everything else we should copy and evaluate the components:
    case
        CONSTR,
        CONSTR_1_0,
        CONSTR_2_0,
        CONSTR_1_1: {

        (should) = ccall shouldCompact(compact "ptr", p "ptr");
        if (should == SHOULDCOMPACT_IN_CNF) { P_[pp] = p; return(); }

pp is the address to store the result in. p is the untagged pointer. The fix is simple. Use tag | p instead of p (as this code already does in other places!).

I will put up a patch shortly.

This caused #21189 (closed)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information